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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:44:13+00:00 2026-06-16T05:44:13+00:00

My android app isn’t starting for some reason. it’s a really basic app. When

  • 0

My android app isn’t starting for some reason. it’s a really basic app. When I run it, it just says that it has to close and I press force close.

import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.ActionBar.TabListener;
import com.actionbarsherlock.app.*;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;


public class MainActivity extends SherlockFragmentActivity implements TabListener{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

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

        Tab tabRed = actionBar.newTab();
        tabRed.setText("Red Side");
      //  tabRed.setTabListener(new TabListener<TabFragment>(this, "tab1", TabFragment.class));
        Tab tabBlue = actionBar.newTab();
        tabBlue.setText("Blue Side");
       // tabBlue.setTabListener(new TabListener<TabFragment>(this, tabBlue, TabFragment.class));

        actionBar.addTab(tabRed);
        actionBar.addTab(tabBlue);


    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        Log.d("Main Activity", "tab " + String.valueOf(tab.getPosition()) + " clicked");

    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
        Log.d("Main Activity", "tab " + String.valueOf(tab.getPosition())+ " un-clicked");

    }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) {
        Log.d("Main Activity", "tab " + String.valueOf(tab.getPosition()) + " re-clicked");


    }



}

This is my activity_main.xml, which just has text in it. Do I have to set up the action bar in the xml as well?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >



     <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/hello_world" />

</RelativeLayout>

The logcat

12-22 00:19:37.846: E/AndroidRuntime(1833): FATAL EXCEPTION: main
12-22 00:19:37.846: E/AndroidRuntime(1833): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.say.upscorer/org.say.upscorer.MainActivity}: java.lang.IllegalStateException: Action Bar Tab must have a Callback
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.os.Looper.loop(Looper.java:123)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.ActivityThread.main(ActivityThread.java:4627)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at java.lang.reflect.Method.invokeNative(Native Method)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at java.lang.reflect.Method.invoke(Method.java:521)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at dalvik.system.NativeStart.main(Native Method)
12-22 00:19:37.846: E/AndroidRuntime(1833): Caused by: java.lang.IllegalStateException: Action Bar Tab must have a Callback
12-22 00:19:37.846: E/AndroidRuntime(1833):     at com.actionbarsherlock.internal.app.ActionBarImpl.configureTab(ActionBarImpl.java:424)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at com.actionbarsherlock.internal.app.ActionBarImpl.addTab(ActionBarImpl.java:450)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at com.actionbarsherlock.internal.app.ActionBarImpl.addTab(ActionBarImpl.java:438)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at org.say.upscorer.MainActivity.onCreate(MainActivity.java:33)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-22 00:19:37.846: E/AndroidRuntime(1833):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-22 00:19:37.846: E/AndroidRuntime(1833):     ... 11 more
  • 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-16T05:44:14+00:00Added an answer on June 16, 2026 at 5:44 am

    Each of your Tabs must have a TabListener, for instance:

    Tab tabRed = actionBar.newTab();
    tabRed.setText("Red Side");
    tabRed.setTabListener(this);
    actionBar.addTab(tabRed);
    
    // The same is true for tabBlue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My android app requires that the device has an SDcard and that SDcard is
I am working on an Android app that has multiple screens the user will
I need to test some android app but I depends of some thing that
I have an android app that has has this css for the body background:
I'm attempting to run an Android app, that makes use of Google's map API,
I have written a small android app that grabs some data and displays it
My Android app has a tab bar that uses an Intent to launch the
I'm making Android app that has this database in it: public void onCreate(SQLiteDatabase db)
My android app has a two word app name, and the 2nd word doesn't
Goal: Build an Android app that discovers the names and addresses of BT devices

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.