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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:55:04+00:00 2026-05-31T08:55:04+00:00

I have an app using a tab bar host api that I found and

  • 0

I have an app using a tab bar host api that I found and I am trying to use it to change activities when I receive a Sms message.

The receiver that was build into this tab host is the following:

public class ChangeTabBroadcastReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        int index = intent.getExtras().getInt(CURRENT_TAB_INDEX);
        setCurrentTab(index);
    }
}

This is defined in the ScrollableTabActivity.java, then the ScrollableTabHost extends this and is called in the bellow method when a Sms is reveived:

Intent intent2 = new Intent(context,ScrollableTabHost.class);    
intent2.putExtra("CURRENT_TAB_INDEX", index);
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent2); 

There is also an OnTabChanged listener build in which prints the index of the tab to the log. When i send a text from the emulator I shows that the tab was changed to index 0 twice, no matter which index I try to set it to.
I have been looking for a while and cant find why I am getting 0 instead of the index that I send.

  • 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-31T08:55:05+00:00Added an answer on May 31, 2026 at 8:55 am

    Ok so i figured this out. Turns out I was just did not have to code setup the way the tab bar api wanted it the correct code to switch to a new activity in one of my tabs is as follows:

        Intent intent2 = new Intent(ScrollableTabHost.ACTION_CHANGE_TAB);    
        intent2.putExtra(ScrollableTabHost.CURRENT_TAB_INDEX, 4); 
        context.sendBroadcast( intent2 );
    

    If anyone is wondering the api is from https://github.com/honcheng/ScrollableTabHost-for-Android
    Its a pretty good tab host.

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

Sidebar

Related Questions

I have an ios5 app developed using storyboards that currently displays a tab bar
I have three views that I switch between using a tab bar, and the
I have an app using a tab bar and, when the app loads, I
I have an app with 3 views. I am using a tab bar controller
If I have a tab bar app, and plan on using Core Location in
I have an app using PHP and the PayPal API. The basic way it
Using Xcode 4.2, I created a new app using the tab bar template. For
I have a multiview application using a tab bar to switch views. One is
I have worked in tab bar, using TabHost to develop the tab1, tab2 and
For my IOS app, i am using a tab bar controller on a mainstoryboard.

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.