Created
December 23, 2017 13:49
-
-
Save muhakmal/b6c5065a565ff0a83a5b81bf3fe203ab to your computer and use it in GitHub Desktop.
navigasi drawer item
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onNavigationItemSelected(MenuItem item) { | |
int id = item.getItemId(); | |
if (id == R.id.nav_beranda) { | |
viewPager.setCurrentItem(0); | |
} else if (id == R.id.nav_info_akun) { | |
Intent infoAkun = new Intent(MainActivity.this, InfoAkunActivity.class); | |
startActivity(infoAkun); | |
} else if (id == R.id.nav_riwayat_order) { | |
Intent riwayatOrder = new Intent(MainActivity.this, RiwayatOrderActivity.class); | |
startActivity(riwayatOrder); | |
} else if (id == R.id.nav_kontak_kami) { | |
try { | |
Intent emailIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + "kontak@masakini.xyz")); | |
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Kontak MasakIni | "); | |
startActivity(emailIntent); | |
} catch (ActivityNotFoundException e) { | |
//nothing | |
} | |
} | |
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | |
drawer.closeDrawer(GravityCompat.START); | |
return true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment