Issue
I want to replace a ListView
item with a Fragment
when certain conditions are met, but the View
, inside which I want to add it has no id (i.e. view's getId()
returns 0xffffffff
)
View view = lv.getChildAt(pos);
FragmentManager fm = ((PagerAdapter)getAdapter()).getItem(getCurrentItem()).getChildFragmentManager();
fm.beginTransaction().add(view.getId(), new AddPlaylistItemFragment()).commit();
view
is a LinearLayout
if it helps.
Any ideas on how to solve this
E/AndroidRuntime(1731): android.content.res.Resources$NotFoundException: Unable to find resource ID #0xffffffff
error?
Solution
You have to give them an ID. Or a tag. The view is coming from your listview, you put it in there. Probably using an adapter's getView. There where you create the view, give it an ID or a tag.
This one might be interesting Android: View.setID(int id) programmatically - how to avoid ID conflicts?
Answered By - ElDuderino
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.