I have an app which has a PagerAdapter with a few Fragments. From the main activity, I start a REQUEST_PICTURE_CAPTURE intent, it works ok, when it ends it calls onActivityResult(). In onActivityResult(), I have simple code:
m_PagerAdapter.GetTheFrag().DoStuff(..., ...);
Where m_PagerAdapter = derived from a PagerAdapter,
GetTheFrag() = // returns the derived Fragment object, which wasn't null before starting the Intent. This is the problem,
DoStuff() ==> never gets called, because m_PagerAdapter.GetTheFrag() is null .
The weird thing is that sometimes it does work and sometimes not, doesn't matter what picture quality or any capture related properties.
// In PagerAdapter
public MyFrag GetTheFrag() {
return m_MyFrag;
}
// In PagerAdapter
private View getViewByID(Integer integerID) {
switch (integerID) {
case R.layout.my_frag:
if (m_MyFrag == null) {
m_MyFrag = new MyFrag(m_MainActivity);
}
return m_MyFrag.GetMyFragView();
}
return null;
}
// In MyFrag
public View GetMyFragView() {
return m_ThisView;
}
Aucun commentaire:
Enregistrer un commentaire