Change Activity via Options Menu


  1. gorjan

    gorjan New Member

    Hi All,

    I'm really new to Android development, so I have one basic question.
    I have the following code. I want to change the screen(the Activity) via Options menu:

    Code (Text):
    @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // TODO Auto-generated method stub
            switch (item.getItemId())
            {
            case R.id.item01:
                Intent intentItem1 = new Intent(this, Item1Activity.class);
                startActivityForResult(intentItem1, 0);
                //startActivity(intentItem1);
                return true;
               
            default: return super.onOptionsItemSelected(item);
            }
           
        }
    But the activity doesn't change and the error message I receive while debugging is that "The resource doesn't exist"

    Any ideas?

    Thanks in advance.

    Advertisement
    :
  2. Martimus

    Martimus One bite at a time... Moderator

    gorjan likes this.
  3. Steven58

    Steven58 Reformed PH VIP Member

    Welcome to the Android Forums community! Glad you signed up! Please feel free to join the conversations! If you need any help getting around, please PM me and I'll try to help! :D
Loading...

Share This Page