android - xamarin navigate from one fragment to another -
i trying navigate on fragment click button in original fragment. how ever got exception
the problem passing layout in call of transaction.replace(), instead should pass id of viewgroup fragment inserted in layout.
so layout of activity containing fragments should this:
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="fill_parent" /> </framelayout>
and in fragmentstocksearch fragment, override oncreateview this:
public override view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { return inflater.inflate(resource.layout.your_layout, null, false); }
and fragment transaction code:
var trans = new fragmentmanager.begintransaction(); trans.replace(resource.id.content_frame, new fragmentstocksearch(), "fragmentstocksearch"); trans.addtobackstack(null); trans.commit();
Comments
Post a Comment