Saturday, July 25, 2015

android: Go to new activity by clicking menu item

You can use this to go New activity
 @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            switch (item.getItemId()) {
                case R.id.about_us:
                    Intent intentAbout = new Intent("com.clouditbd.payme.AboutUs"); //AboutUs is new activity class
                    startActivity(intentAbout);
                    return true;
                case R.id.exit:
                    if (isConnected()) {
                        Intent intentExit = new Intent("com.clouditbd.payme.Logout");
                        startActivity(intentExit);
                    } else {
                        Toast.makeText(getBaseContext(), "Please check your internet connection.", Toast.LENGTH_SHORT).show();
                    }
                    return true;
                default:
                    return super.onOptionsItemSelected(item);
            }
        }

No comments:

Post a Comment