I don't know how to descibe this. I have two activities full of links (to other activitys) so like a menu or list. Basicly I can split the links in "physics" and "maths" (yes I need this for education). I made two links in my actionbar, like this:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:showAsAction="never" />
<item
android:id="@+id/maths"
android:title="@string/maths"
android:orderInCategory="1"
android:showAsAction="always|withText"
android:titleCondensed="@string/maths"
android:icon="@drawable/ic_action_calculator" />
<item
android:id="@+id/physics"
android:icon="@drawable/ic_action_line_chart"
android:title="@string/physics"
android:orderInCategory="2"
android:showAsAction="always|withText"/>
</menu>
Everything is working great, I have like "tabs" on the bottom of my app. Following code is working too:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.maths:
return true;
case R.id.physics:
Intent myIntent2 = new Intent(Home.this, ActivityPhysics.class);
startActivity(myIntent2);
default:
return super.onOptionsItemSelected(item);
}
}
As you can see, when clicked on "math" it does nothing, because I am already in maths.
When clicked on "physics" it's opening ActivityPhysics.
My problem is, that when I click on physics and go to physics, then click on math and go to math, and that many times, i have to press the back button a bunch of times, and it boes back to math and back to physics...(understand, what I mean? sorry, I'm german :D )
Yeah and that "back back back back" sucks :)