Trouble with android navigation Drawer -
I created an item in the NAV drawer link for my curd, using a simple navigation drawer, but once I I want to click on an item in the NAV drawer that wants me to take a list view. As far as I see it is connected only to Java class which spreads the piece, as soon as I mentioned that it exits from the list.
I use the navigation drawer:
First of all I used the Navigation Drawer A click listener was set in ListView
mDrawerList.setOnItemClickListener (new DrawerItemClickListener ()); DrawerItemClickListener applies a custom class
DruwerItemClickListener to the Private Sector ListView.OnItemClickListener {@Override public void onItemClick (AdapterView & lt ;? & gt; Parents, view view, int position, long id) {echime (position); }} This call for select zero (int position)
Private zero selectItem (int position) {FragmentTransaction ft = GetSupportFragmentManager () .beginTransaction (); Switch (position) {case0: ft.replace (R.id.content_frame, new firstfragment ()); SetTitle ("first"); break; Case 1: Feet. (RID content_frame, new seconds fragment ()); SetTitle ("second"); break; Case 2: Foot (Readcontent_frame, new third fragment ()); SetTitle ("third"); break; } Ft.commit (); MDrawerList.setItemChecked (position, true); MDrawerLayout.closeDrawer (mRelativeLayout); } Here you can set any piece of any kind. With this you will not mismatch any piece type.
In addition, you can follow an official navigation drawer example provided by Android developers.
Hope it helps.
Comments
Post a Comment