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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:01:01+00:00 2026-06-16T07:01:01+00:00

I am trying to add tabs to action bar sherlock, but it keeps on

  • 0

I am trying to add tabs to action bar sherlock, but it keeps on crashing and won’t start. What am I supposed to put in the xml files, I can’t find what to put in them

MainActivity.java

import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.ActionBar.TabListener;
import com.actionbarsherlock.app.*;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;

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


public class MainActivity extends SherlockFragmentActivity{

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

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

        ActionBar.Tab tabData = actionBar.newTab();
        tabData.setText("Match Data");
        tabData.setTabListener(new MyTabListener());
        actionBar.addTab(tabData);

      //  tabRed.setTabListener(new TabListener<TabFragment>(this, "tab1", TabFragment.class));
       /* Tab tabComp = actionBar.newTab();
        tabComp.setText("New Competition");
        tabComp.setTabListener(new TabListener<ScoreRedActivity>(this, "B", ScoreRedActivity.class));
        actionBar.addTab(tabComp);*/
       // tabBlue.setTabListener(new TabListener<TabFragment>(this, tabBlue, TabFragment.class));





    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu){
        MenuInflater inflater = getSupportMenuInflater();
        inflater.inflate(R.menu.activity_main, menu);
        return true;
    }

    private class MyTabListener implements ActionBar.TabListener{
        @Override
        public void onTabSelected(Tab tab, FragmentTransaction ft){
            if(tab.getPosition() == 0)
            {
                ScoreRedActivity frag = new ScoreRedActivity();
                ft.replace(R.id.textView1, frag);

            }
        }

        @Override
        public void onTabUnselected(Tab tab, FragmentTransaction ft){

        }

        @Override
        public void onTabReselected(Tab tab, FragmentTransaction ft){
        }

    }



}

My ScoreRedActivity.java which is a fragment

import com.actionbarsherlock.app.SherlockFragment;

import android.os.Bundle;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

public class ScoreRedActivity extends SherlockFragment {

    EditText t;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_score_red, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState){
        t = (EditText) getActivity().findViewById(R.id.weightedRed);
    }

}

activity_score_red.xml

<LinearLayout 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=".ScoreRedActivity" >

    <TextView 
        android:layout_height="wrap_content"
        android:layout_width="wrap_content" 
        android:text="You are presently in Fragment A" 
        android:id="@+id/textView1"/>

    <Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:text="Click me for toast"
        android:id="@+id/button1"/>


</LinearLayout>

here’s the logcat

12-22 13:21:38.076: E/AndroidRuntime(394): FATAL EXCEPTION: main
12-22 13:21:38.076: E/AndroidRuntime(394): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.say.upscorer/org.say.upscorer.MainActivity}: android.support.v4.app.SuperNotCalledException: Fragment ScoreRedActivity{45f8b1c8 #0 id=0x1020002} did not call through to super.onActivityCreated()
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.os.Handler.dispatchMessage(Handler.java:99)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.os.Looper.loop(Looper.java:123)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.ActivityThread.main(ActivityThread.java:4627)
12-22 13:21:38.076: E/AndroidRuntime(394):  at java.lang.reflect.Method.invokeNative(Native Method)
12-22 13:21:38.076: E/AndroidRuntime(394):  at java.lang.reflect.Method.invoke(Method.java:521)
12-22 13:21:38.076: E/AndroidRuntime(394):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-22 13:21:38.076: E/AndroidRuntime(394):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-22 13:21:38.076: E/AndroidRuntime(394):  at dalvik.system.NativeStart.main(Native Method)
12-22 13:21:38.076: E/AndroidRuntime(394): Caused by: android.support.v4.app.SuperNotCalledException: Fragment ScoreRedActivity{45f8b1c8 #0 id=0x1020002} did not call through to super.onActivityCreated()
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1470)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:931)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.Activity.performStart(Activity.java:3781)
12-22 13:21:38.076: E/AndroidRuntime(394):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
12-22 13:21:38.076: E/AndroidRuntime(394):  ... 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-16T07:01:02+00:00Added an answer on June 16, 2026 at 7:01 am

    You needed to add

    super.onActivityCreated(savedInstanceState) 
    

    after

    t = (EditText) getActivity().findViewById(R.id.weightedRed); 
    

    This is because, as your LogCat says

    did not call through to super.onActivityCreated()
    

    Some methods, namely the ones that have to do with initializing and the lifecycle of Activities and Fragments need to have a call to the superclass method they override because there are things done higher up the chain that you are not overriding.Be aware though, that not all overriden methods need a call to super, Activity and Fragment lifecycle methods are a special case just because they’re so complicated and you can’t be expected to rewritethe whole Activity/Fragment class every single time you make an application.

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

Sidebar

Related Questions

I am trying to add tabs dynamically using AvalonDock with WPF, but I am
I am trying to add the following tabs to the following panel, between the
Im new to asp.net mvc. I'm trying add new model class but it got
Trying to add a blank sample app for a rails tutorial to GitHub, but
Trying to add a class object into a List using reflection, but when invoking
I am creating an android application and am trying to add three tabs underneath
I am trying to add a progress bar. everything works and i don't get
I'm trying to load in AJAX content into an empty but the div won't
So i'm trying to make tabs with the JQuery UI framework, but I can't
Trying to add an onclick handler to my tabs, and can't seem to get

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.