1

my Fragmentactivity starts an AsyncTask in the onCreate method and also creates a FragmentPagerAdapter which initializes in the getItem method 3 ListFragments (Like in this example http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabsPager.html). But how do I populate the fragments lists in my onPostExecute?

I tried to save the Fragments ID in a Map and returned them out of the FragmentPagerAdapter, but that always leads to NullPointerExceptions...

    @Override
    public ListFragment getItem(int position) {
        ListFragment newFragment = ArrayListFragment.newInstance(position);
        FragmentTable.put(position,newFragment.getId());
        return newFragment;
    }

    public ListFragment getInitializedItem(int postition) {
        return (ListFragment) fm.findFragmentById(FragmentTable.get(postition));
    }
Tyde
  • 303
  • 2
  • 11

0 Answers0