I am new in Android development. I want to ask how can I create an overflow menu with two items. Also, how can I combine it with an option menu I already did, which looks like this:
public class MainActivity extends Activity {
@Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater blabla = getMenuInflater();
blabla.inflate(R.menu.options_menu ,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()){
case R.id.OurSponsors:
Intent i = new Intent("com.--.------.------");
startActivity(i);
break;
case R.id.exit:
finish();
break;
}
return false;
}
xml
<item
android:title="Our Sponsors"
android:id="@+id/OurSponsors"
android:icon="@drawable/image"
/>
<item
android:title="Exit"
android:id="@+id/exit"
android:icon="@drawable/exit"
/>
I am a beginner.