Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to close sliding-menu on List Activity Click
    text
    copied!<p>I have an app that implement sliding menu from <strong>jfeinstein10</strong>. all my apps are not using fragment. so i change the list of fragment into list activity. when i click that list, it start another activity. But the sliding menu didn't close. it still in slide mode. i just want to "when i click item in list activity, it closes slide menu and start an activity." i have tried like this. </p> <pre><code>@Override public void onListItemClick(ListView lv, View v, int position, long id) { Fragment newContent = null; Fragment Intent = null; switch (position) { case 0: Intent intent2 = new Intent(); intent2.setClass(getActivity(), tab.class); intent2.putExtra("index", position); startActivity(intent2); break; case 1: Intent intent = new Intent(); intent.setClass(getActivity(), about.class); intent.putExtra("index", position); startActivity(intent); break; case 2: Intent intent3 = new Intent(); intent3.setClass(getActivity(), tab1.class); intent3.putExtra("index", position); startActivity(intent3); break; case 3: Intent intent4 = new Intent(); intent4.setClass(getActivity(), latin.class); intent4.putExtra("index", position); startActivity(intent4); break; case 4: newContent = new ColorFragment(android.R.color.black); break; } if (newContent != null) switchFragment(newContent); if (Intent != null) switchFragment(Intent); } </code></pre> <p>I know its dumb to use <code>Fragment Intent = null;</code> And <code>If (Intent != Null) switchFragment(Intent);</code>. I know its just for fragment only, but is there another way to switch it like that? So that when click, the slide menu closed and start the activity. Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload