Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:35:11+00:00 2026-06-18T15:35:11+00:00

I am using ActionBarSherlock to implement ActionBar for both Pre/post versions of Android HoneyComb.

  • 0

I am using ActionBarSherlock to implement ActionBar for both Pre/post versions of Android HoneyComb.
My problem is that when I tap top-left icon on Android version 4.0.4, it did not respond.
Here is what I have done till now:

1) In all style folders “values/styles.xml” , “values-v11/styles.xml” & “values-v14/styles.xml”; I have done the following

<style name="ActivityTheme" parent="@style/AppTheme">
        <item name="actionBarStyle">@style/ActivityActionBarStyle</item>
        <item name="android:actionBarStyle">@style/ActivityActionBarStyle</item>
    </style>
<style name="ActivityActionBarStyle" parent="ommaralrd_transparent_ActionBar">
        <item name="displayOptions">showHome|showTitle|homeAsUp</item>
        <item name="android:displayOptions">showHome|showTitle|homeAsUp</item>
    </style>

In any application activity (except Home activity since it should not have Up arrow), I have done the following:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inner);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
            getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        }
.....rest of my code ...
}


@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent intent;
        switch (item.getItemId()) {
        case android.R.id.home:

            /*app icon in action bar clicked; go home*/
            intent = new Intent(this, MainActivity.class);

            /* With this flag, if the activity you're starting already exists in the current task, 
             * then all activities on top of it are destroyed and it is brought to the front.
             * you should usually not create a new instance of the home activity. Otherwise, 
             * you might end up with a long stack of activities in the current task with multiple 
             * instances of the home activity.*/
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            break;
        default:
            return super.onOptionsItemSelected(item);
        }
        return true;
    }

In the Manifest file, I make sure that I have applied the respective style to all activities (except main activity since it should not have Up arrow)

<activity
            android:name="com.andrid.example.TestActivity"
            android:label="@string/app_name"
            android:theme="@style/ActivityTheme" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.andrid.example.MainActivity" />
        </activity>

So now when I test the application on Pre-HoneyComb version, the Up arrow is never shown which is correct since ABS can’t respond at all if icon was tapped to navigate up.
But when I tried the application on Post-HoneyComb version like 4.1 on Emulator, the Up arrow is shown and when I tapped it, it works as expected and navigates up normally.
My problem is that when I tried the application on Android 4.0.4 emulator , the Up arrow is shown as expected but when I tapped it, it do nothing

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:35:13+00:00Added an answer on June 18, 2026 at 3:35 pm

    I have found the fix:
    Simply I should avoid set the Icon Home as Up using xml attribute: homeAsUp but instead I should have used setDisplayHomeAsUpEnabled(true) explicitly as follows:

    In all style folders “values/styles.xml” , “values-v11/styles.xml” & “values-v14/styles.xml”; I have done the following

    <style name="ActivityTheme" parent="@style/AppTheme">
            <item name="actionBarStyle">@style/ActivityActionBarStyle</item>
            <item name="android:actionBarStyle">@style/ActivityActionBarStyle</item>
        </style>
    <style name="ActivityActionBarStyle" parent="ommaralrd_transparent_ActionBar">
            <item name="displayOptions">showHome|showTitle</item>
            <item name="android:displayOptions">showHome|showTitle</item>
        </style>
    

    in Each Activity (except main activity):

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
                getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display custom search in actionbar (I'm using ActionBarSherlock for that). I
I'm using ActionBarSherlock to implement an ActionBar with tabs in my application. When I
I'm using ActionBarSherlock. On Android 3.0+, there's a subtle shadow under the ActionBar. But
I am using ActionBarSherlock to implement action bar on my Android 2.1 API 7
I am using ActionBarSherlock to implement action bar for Android 2.1 platform. But in
I'm using ActionBarSherlock in my Android project, and it's awesome. One small issue: My
I'm using ActionBarSherlock and have a little problem. In the Fragment Tabs example, there
I'm using ActionBarSherlock and a SherlockDialogFragment. i have a little problem for my project,,i
I am using ActionbarSherlock with a SherlockListFragment that implements LoaderManager.LoaderCallbacks . In my ApplicationActivity
I'm currently using ActionBarSherlock in my app and I'm looking to implement Google's EasyTracker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.