I basicall have an AsyncTask
(run from main Activity
) that populates a ViewPager
inside a fragment. I'm inflating an xml layout file to populate the ViewPager
.
The problem is that I can't get pointers to the views inside the layout (imageview, textview) so that I can change then at runtime. I know it's probably because getView()
returns null
. I've read that it's probably because onCreateView()
hasn't been called, yet. Anybody know what I can do to solve this?
My code's a bit of a mess right now.
Here's a simpler explanation to what I'm doing:
- MainActivity Asynctask populates a database and sends pointer to Fragment. Something like SendToFragement(db);
- The Fragment method ReceiveFromActivity(db) receives db pointer and populates the ViewPager.
It works fine if I'm just creating TextViews, setting text, and adding TextViews to the Viewpager. But, of course, I want to make it look better so I've inflated an xml layout. The problem is that I can't change the contents of the xml layout because getView()
is returning NULL
so getView().findViewById()
doesn't work.