I have created an App With Navigation Drawer and am using fragments. I have this particular fragment which uses a ListView and the List is Populated using JSON . When I try to open the particular fragment , the App Crashes and this is the LogCat result. Please Help.
Asked
Active
Viewed 99 times
-2

Jonathon Reinhart
- 132,704
- 33
- 254
- 328

Bhargav
- 227
- 1
- 11
-
1You need to show your java file and also xml file. – Piyush Apr 28 '14 at 07:47
-
Java Code - http://pastebin.com/2PgD0zAV XML - http://pastebin.com/wzsj8uhn – Bhargav Apr 28 '14 at 07:54
2 Answers
1
In your xml file you need to change for ListView
ID from
android:id="@+id/events"
to
android:id="@+id/android:list"
UPDATE:
You have just declared your ProgressDialog
variable named pDialog
not initialize So initialize it in onPreExecute()
method like
pDialog = new ProgressDialog(getActivity());
pDialog.setMessage("Loading Events...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();

Piyush
- 18,895
- 5
- 32
- 63
0
My quess..You are using a ListFragment derived class with an xml file that has a view in it with the id android.R.id.list. That view is not a ListView.
When you use a listfragment derived fragment you do not need an xml layout file, but if you create one the listview in it has to have the id android.R.id.list

Arno van Lieshout
- 1,570
- 1
- 13
- 19
-
So I can go ahead and delete the XML Layout file and remove the link ? – Bhargav Apr 28 '14 at 07:56
-
If you want to use just a listview, however you need to reference the listview using getListView() and set the adapter using setListAdapter. You could also keep the xml file, it does not matter just make sure the listview has the correct id (and no other view has it). – Arno van Lieshout Apr 28 '14 at 07:58