Search code examples
androidandroid-listfragment

Xml parse with ListFragment in Android


I am currently developing an android project which connects to a service and gets xml and parses it in an asynctask, then displays it in a ListView. I am using a standard ListActivity and it is working perfectly fine, but I want to use ListFragment and I can't tell from the API samples if it is better to do the xml parsing in the activity or the fragment. And if I did the parsing in the activity, how would I pass the arraylist to my fragment to display it?

Any help or tutorials would be appreciated.

Thank you!


Solution

  • I was able to do the asyncTask inside of the ListFragment, so it was not necessary to pass the array to the fragment from the activity. I just created a method that did my asynctask inside of the fragment and passed the variables I needed through my activity intent.