android - Dynamically replacing the fragment of a viewpager with another fragment -


i'm using viewpager has 6 fragments(i.e) 6 pages, want replace fragment new fragment dynamically.. i'm using fragmentstatepageradapter , overriding getitemposition method following code inside getitemposition method.

                 fragment myfragment  = (fragment)object;               fragmenttransaction trans = getsupportfragmentmanager().begintransaction();         fragment ivitefragment = new invitefragment();         trans.detach(myfragment);         trans.add(mpager.getid(), ivitefragment);                     trans.commit();         return position_none; 

this doesn't work.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -