Sunday, 15 May 2011

Android Slide Menu can not replace fragment -



Android Slide Menu can not replace fragment -

i seek create slide menu.wrote code witch can show /hide slide menu,but want replace fragments in listview click listener.when click listview can not replace fragments xml code

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.coboltforge.slidemenu.slidemenu android:id="@+id/slidemenu" android:layout_width="match_parent" android:layout_height="match_parent" > </com.coboltforge.slidemenu.slidemenu> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/buttonmenu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/menubutton" /> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/buttonmenu" android:background="#ff0000" > </framelayout> </relativelayout>

and part mainactivity.java code

@override public void onslidemenuitemclick(int itemid) { navigateto(itemid); } private void navigateto(int position) { switch (position) { case 0: getsupportfragmentmanager() .begintransaction() .replace(r.id.content_frame, stradabooking.newinstance(), stradabooking.tag).commit(); break; case 1: getsupportfragmentmanager() .begintransaction() .replace(r.id.content_frame, stradacontact.newinstance(), stradacontact.tag).commit(); break; case 2: getsupportfragmentmanager() .begintransaction() .replace(r.id.content_frame, stradabooking.newinstance(), stradabooking.tag).commit(); break; case 3: getsupportfragmentmanager() .begintransaction() .replace(r.id.content_frame, stradacontact.newinstance(), stradacontact.tag).commit(); break; } }

android android-fragments

No comments:

Post a Comment