Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Even With setHomeButtonEnabled(true) App Icon not Clickable in Android 14

my Code: (Updated) I've Added my onCreateOptionsMenu And onOptionsItemSelected Method here :

  ActionBar actionBar = getActionBar();
  actionBar.setHomeButtonEnabled(true);
  actionBar.setDisplayHomeAsUpEnabled(true);
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.login, menu);
    return true;
    }
   @Override
   public boolean onOptionsItemSelected(MenuItem item) {
   // Handle item selection
   switch (item.getItemId()) {
       case R.id.action_createInvoice:
           startActivity(new Intent("com.domain.Activity1"));
           return true;

       default:
           return super.onOptionsItemSelected(item);
       }
   }

my Manifest File:

    <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="17" />

    <activity android:label="@string/activity" android:name=".Activity"
        android:parentActivityName="com.some.activity">
         <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value="com.some.activity" />
        <intent-filter>
            <action android:name="com.this.activity" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

With this settings, App Icon not Clickable in Android 14 Emulator

like image 614
Adnan Avatar asked Aug 07 '13 11:08

Adnan


1 Answers

override onOptionsItemSelected() :

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // do your stuff here, eg: finish();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

For a list of Android's ids :http://developer.android.com/reference/android/R.id.html#home

like image 197
tom91136 Avatar answered Nov 13 '22 00:11

tom91136