I basicall has AsyncTask(runs from the core Activity) that fills ViewPagerinside the fragment. I inflate the xml layout file to fill ViewPager.
The problem is that I cannot get pointers to the views inside the layout (imageview, textview) so that I can change it at runtime. I know this, probably because it getView()returns null. I read that, probably because I onCreateView()have not yet been called. Does anyone know what I can do to solve this?
My code is a bit of a mess right now.
Here is a simpler explanation of what I'm doing:
- MainActivity Asynctask populates the database and sends a pointer to the fragment. Something like SendToFragement (db);
- The ReceiveFromActivity (db) fragment method gets a pointer to db and populates the ViewPager.
It works fine if I just create TextViews, set the text and add TextViews to the Viewpager. But of course I want it to look better, so I puffed out an xml layout. The problem is that I cannot change the contents of the xml layout because it getView()returns null, therefore it getView().findViewById()does not work.
source
share