java - BaseAdapter Fragment Change page -


public class listviewadapter extends baseadapter { . . . programlarfragment myfragment = new programlarfragment();             bundle bundle = new bundle();             bundle.putstring("asd","asdasdasdasd");             myfragment.setarguments(bundle);             android.support.v4.app.fragmenttransaction fragmenttransaction = getsupportfragmentmanager().begintransaction();             fragmenttransaction.replace(r.id.fragment_container, myfragment);             fragmenttransaction.commit(); 

getsupportfragmentmanager error me pls enter image description here

assuming context object appcompatactivity or actionbaractivity (deprecated)

try doing this;

programlarfragment myfragment = new programlarfragment(); bundle bundle = new bundle(); bundle.putstring("asd","asdasdasdasd"); myfragment.setarguments(bundle);  /*     use passed in context value ,     cast class has getsupportfragmentmanager    assuming class creates adapter 1 of these     class instances either appcompatactivity or actionbaractivity    , cast 1 using, recommend using appcompatactivity    actionbaractivity deprecated  */ android.support.v4.app.fragmenttransaction fragmenttransaction = ((appcompatactivity)this.context).getsupportfragmentmanager().begintransaction(); fragmenttransaction.replace(r.id.fragment_container, myfragment); fragmenttransaction.commit(); 

please see:

http://developer.android.com/reference/android/support/v4/app/fragmentactivity.html

under known direct sub classes can see appcompatactivity , indirect sub classes can see actionbaractivity mentions deprecated


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -