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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:51:55+00:00 2026-06-09T12:51:55+00:00

I am using ActionBarSherlock to provide ActionBars for pre HoneyComb devices. My Activity has

  • 0

I am using ActionBarSherlock to provide ActionBars for pre HoneyComb devices.

My Activity has four fragments namely 1. User 2. Chat 3. Video 4. Extra, see image

enter image description here

I have created actionBar using following code:-

            actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        actionBar.setTitle("Meeting");
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);

        /* Set Custom view */


        ActionBar.Tab tab = actionBar.newTab();
        // tab.setText("Meeting Users");
        tab.setIcon(R.drawable.users);
        tab.setTabListener(this);
        actionBar.addTab(tab);

        tab = actionBar.newTab();
        // tab.setText("Chat");
        tab.setIcon(R.drawable.chat);
        tab.setTabListener(this);
        actionBar.addTab(tab);

        tab = actionBar.newTab();
        // tab.setText("Video");
        tab.setIcon(R.drawable.video_call);
        tab.setTabListener(this);
        tab.select();
        actionBar.addTab(tab);

        tab = actionBar.newTab();
        // tab.setText("Extra");
        tab.setIcon(R.drawable.extra);
        tab.setTabListener(this);
        actionBar.addTab(tab);

I want to draw something on those tabs, for example draw and/OR blink on chat tab, whenever chat messages arrives and user is on some other tab.

How can I do this ? please help.

  • 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-09T12:51:57+00:00Added an answer on June 9, 2026 at 12:51 pm

    This is How I solved my problem, Hope it can be useful for someone else too….

    First I created a CutomImageView by extending ImageView

    package com.myexample.newsessionwindowsrbrdemo;
    
    import android.content.Context;
    import android.graphics.Canvas;
    import android.graphics.Color;
    import android.graphics.Paint;
    import android.renderscript.Font.Style;
    import android.widget.ImageView;
    
    public class CustomImageView extends ImageView {
        private int notificationCount;
    
        /**
         * @param context
         */
        public CustomImageView(Context context) {
            super(context);
            notificationCount = 0;
        }
    
        public synchronized void incrementNotification() {
            notificationCount--;
            this.invalidate();
        }
    
        public synchronized void decrementNotification() {
            notificationCount++;
            this.invalidate();
        }
    
        /**
         * @return the notificationCount
         */
        public synchronized int getNotificationCount() {
            return notificationCount;
        }
    
        /**
         * @param notificationCount
         *            the notificationCount to set
         */
        public synchronized void setNotificationCount(int notificationCount) {
            this.notificationCount = notificationCount;
            this.invalidate();
        }
    
        /*
         * (non-Javadoc)
         * 
         * @see android.widget.ImageView#onDraw(android.graphics.Canvas)
         */
        @Override
        protected void onDraw(Canvas canvas) {
            System.out.println("OnDraw is called");
            super.onDraw(canvas);
            Paint paint = new Paint();
            paint.setColor(Color.RED);
            paint.setStyle(Paint.Style.FILL);
            paint.setFakeBoldText(true);
            paint.setTextSize(15);
            canvas.drawText(String.valueOf(notificationCount), 15, 20, paint);
        }
    
    }
    

    Then While creating tabs, I used this image as

    /* Set Custom view */

        mView = new CustomImageView(this);
        mView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT));
    
        mView.setBackgroundResource(R.drawable.users);
        ActionBar.Tab tab = actionBar.newTab();
        tab.setCustomView(mView);
        tab.setTabListener(this);
        actionBar.addTab(tab);
    

    Now whenever the notification changes I call increment/decrement or setter method of CustomImageView and new Notifications are displayed on the image..

    enter image description here

    Suggestions to improve this solution are really welcome…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ActionBarSherlock and have implemented ShareActionProvider . When a user selects an
I'm developping an application using ActionBarSherlock component. My goal is to target all devices
Using C#, I need a class called User that has a username, password, active
If I'm using ActionBarSherlock, and My activity looks like this in Ice Cream Sandwich:
I've been trying to create a new project using the files provided at ActionBarSherlock
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 set up a test app using ActionbarSherlock 4.0, which works fine in the
I'm using Christophe Versiuex's HoloEverywhere library in concert with ActionBarSherlock to display an ICS
I'm trying to build my project using ANT. My project uses ActionbarSherlock, and Roboguice-Sherlock.

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.