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 4014834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:32:42+00:00 2026-05-20T09:32:42+00:00

I have an actionbar which I have inserted into my very few layout screens

  • 0

I have an actionbar which I have inserted into my very few layout screens via…

<include android:id="@+id/main_actionbar" layout="@layout/actionbar" />

The actionbar itself is pretty simple and maybe even very bad but wtf…

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/actionbar" style="@style/ActionBarWrapper">
    <RelativeLayout style="@style/ActionBarContent"
        android:id="@+id/actionBarContent">
        <TextView android:id="@+id/ab_text" style="@style/ActionBarText" />
        <ImageView android:id="@+id/ab_border_01" style="@style/ActionBarBorder01" />
        <ImageView android:id="@+id/ab_icon_01" style="@style/ActionBarIcon01" />
        <ImageView android:id="@+id/ab_border_02" style="@style/ActionBarBorder02" />
        <ImageView android:id="@+id/ab_icon_02" style="@style/ActionBarIcon02" />
        <ImageView android:id="@+id/ab_border_03" style="@style/ActionBarBorder03" />
        <ImageView android:id="@+id/ab_icon_03" style="@style/ActionBarIcon03" />
    </RelativeLayout>
    <ImageView android:id="@+id/ab_footerline" style="@style/ActionBarFooterLine" />
</LinearLayout>

Trying to implement the functionality behind the actionbar I am not sure of how or where to handle clicks that may happen on different screens of the application.

<item name="android:onClick">ab_click</item>

Putting the same clickhandler into every activity would work but would also really stink.

  • 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-05-20T09:32:43+00:00Added an answer on May 20, 2026 at 9:32 am

    Just create a base class extending Activity and include in it all your global action bar click handlers. Example:

    public abstract class BaseActionBarActivity extends Activity {
    
        public void ab_click(View v) {
            // handle your click
        }
    
    }
    

    Then rather than extending Activity in your own app activities, extend from your base class:

    public class MyActivity extends BaseActionBarActivity {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a layout which inludes actionbar and tabs: <TabHost xmlns:android=http://schemas.android.com/apk/res/android android:id=@android:id/tabhost android:layout_width=fill_parent android:layout_height=fill_parent>
I have a library project in which I define an action bar in layout
I have the following problem. On my layout I have an action bar (which
As some of you might have noticed, Android changed the order in which the
See the attached photo. Twitter does it well. They have a layout, which I
I have a UIViewController which is created programmatically. I include the following code in
I have an Android application which retrieves from a external server, a name and
I'm developing an android application which have a kind of action bar and a
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have an actionBar with multiple items, I would like to change the colour

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.