Search code examples
androidjsonandroid-fragmentsfragmentlistactivity

Transform ListActivity to Fragment


Just followed this tut (http://www.androidhive.info/2012/01/android-json-parsing-tutorial/) but thats only in activities.

I want to have a swipe activity ( I will use the template in Android Studio) with two fragments, one should be the list like in the tutorial above.

How can I "convert" the activity to a fragment to use it?

Regards, Tom

EDIT1: ListView lv = getFragmentManager(R.id.list);


Solution

  • Use any fragment example. And Pass that json data from one fragment to another fragment by setArgument() on click of list item. And you can write list item click method on your postExecute() inside the Asynctask.