1. Check out our companion app, Forums for Android! Download from Google Play

Change Activity via Options Menu

Discussion in 'Introductions' started by gorjan, Oct 27, 2010.

  1. gorjan

    gorjan New Member
    Thread Starter
    25

    Oct 27, 2010
    3
    0
    25
    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):
    1. @Override
    2.     public boolean onOptionsItemSelected(MenuItem item) {
    3.         // TODO Auto-generated method stub
    4.         switch (item.getItemId())
    5.         {
    6.         case R.id.item01:
    7.             Intent intentItem1 = new Intent(this, Item1Activity.class);
    8.             startActivityForResult(intentItem1, 0);
    9.             //startActivity(intentItem1);
    10.             return true;
    11.            
    12.         default: return super.onOptionsItemSelected(item);
    13.         }
    14.        
    15.     }
    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...
    843

    Jul 9, 2010
    19,535
    4,045
    843
    Male
    Engineer
    'neath a cactus
    gorjan likes this.
  3. Steven58

    Steven58 Reformed PH
    3,933

    Feb 19, 2010
    32,948
    25,335
    3,933
    Male
    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
     

Share This Page

Loading...