Skip to content Skip to sidebar Skip to footer

My Fragment Is Not Being Attached To The Main Activity Class.

Taking my previous experiences, i am trying to list some custom list items using BaseAdapter , which uses two string from array defined in string values.xml My app is crashing sayi

Solution 1:

You have to mind the fragment lifecycle: onCreateView is before onActivityCreated which means the activity might not be there, so providing the activity withgetActivity() in the adapter in your onCreateView gives you this exception.

activity diagram

http://developer.android.com/guide/components/fragments.html

Post a Comment for "My Fragment Is Not Being Attached To The Main Activity Class."