Skip to content Skip to sidebar Skip to footer

Getting A Nullexception

Possible Duplicate: NULL Exception in my android program Have an Exception: 03-16 17:47:57.058: ERROR/AndroidRuntime(609): FATAL EXCEPTION: main 03-16 17:47:57.058: ERROR/Andr

Solution 1:

Check if the ListAdapter exist on R.layout.country where it looks like you are getting the problem:

findViewById(R.id.countrylistView);

Because your listView have not been instatiated. Can you post the country layout

Solution 2:

ListAdapter is an interface so you can't new a ListAdapter unless you have created a class named ListAdapter somewhere, that's probably a bad idea and you should use a different name.

When creating an Adapter you pass in a layout for the list item, not the id of the ListView.

Solution 3:

Since you have posted your question in another thread, it is clear that the problem is that lv is never initialized in your activity before you call setAdapter in onDestroy(), causing a NullPointerException since it is null, as it is shown in this snippet of your code:

@OverridepublicvoidonDestroy()
 {

    //     adapter.imageLoader.stopThread();//mListUsers=null;


   lv.setAdapter(null);
   super.onDestroy();
 }

Also, when you want to post more data about your problem, just edit your question instead of creating a new one :) I hope this helps.

Solution 4:

Could it be, that

mListUser is null or mListUsers.get(position) is null?

Post a Comment for "Getting A Nullexception"