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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:28:25+00:00 2026-06-17T10:28:25+00:00

I was trying to implement lisadapter in a fragment, but Java does not allow

  • 0

I was trying to implement lisadapter in a fragment, but Java does not allow to extend two superclasses. Thus I was not able to extend Fragment and ListActivity to the same class. Then I changed my app. I replaced all fragments with ListFragment. But When I run my application, it crashes. Earlier it was running fine. Could you pleasa help me out .
Please find below the logcat entries

I have pasted the protab1.xml below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

     <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

         <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
             >


        </LinearLayout>
    </ScrollView>

</LinearLayout>

logcat:

E/AndroidRuntime(959): FATAL EXCEPTION: main
E/AndroidRuntime(959): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pro1/com.example.pro1.Secactivity}: java.lang.RuntimeException: Content has view with id attribute 'android.R.id.list' that is not a ListView class
E/AndroidRuntime(959):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
E/AndroidRuntime(959):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(959):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(959):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(959):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(959):  at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(959):  at android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime(959):  at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(959):  at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(959):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(959):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(959):  at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(959): Caused by: java.lang.RuntimeException: Content has view with id attribute 'android.R.id.list' that is not a ListView class
E/AndroidRuntime(959):  at android.app.ListFragment.ensureList(ListFragment.java:402)
E/AndroidRuntime(959):  at android.app.ListFragment.onViewCreated(ListFragment.java:203)
E/AndroidRuntime(959):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:899)
E/AndroidRuntime(959):  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057)
E/AndroidRuntime(959):  at android.app.BackStackRecord.run(BackStackRecord.java:682)
E/AndroidRuntime(959):  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435)
E/AndroidRuntime(959):  at android.app.Activity.performStart(Activity.java:5113)
E/AndroidRuntime(959):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2153)
E/AndroidRuntime(959):  ... 11 more

Activity class holding ListFragments protab1 and protab2

import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;

public class Secactivity extends Activity {
    public static Context mycontext ;

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.promain);
        mycontext = getApplicationContext();

        //ActionBar
            ActionBar actionbar = getActionBar();
            actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

            ActionBar.Tab PlayerTab = actionbar.newTab().setText("Fragment A");
            ActionBar.Tab StationsTab = actionbar.newTab().setText("Fragment B");

            ListFragment PlayerFragment = new Protab1();
            ListFragment StationsFragment = new Protab2();

            PlayerTab.setTabListener(new MyTabsListener(PlayerFragment));
            StationsTab.setTabListener(new MyTabsListener(StationsFragment));

            actionbar.addTab(PlayerTab);
            actionbar.addTab(StationsTab);
        }


}

class MyTabsListener implements ActionBar.TabListener {
    public ListFragment fragment;

    public MyTabsListener(ListFragment fragment) {
        this.fragment = fragment;
    }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) {
        Toast.makeText(Secactivity.mycontext, "Reselected!", Toast.LENGTH_LONG).show();
    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        ft.replace(R.id.fragment_container, fragment);
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
        ft.remove(fragment);
    }

}

protab1 ListFragment

package com.example.pro1;
import android.annotation.TargetApi;
import android.app.Fragment;
import android.app.ListFragment;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class Protab1 extends ListFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.protab1, container, false);
    }



}

protab2 ListFragment

package com.example.pro1;

import android.annotation.TargetApi;
import android.app.Fragment;
import android.app.ListFragment;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public class Protab2 extends ListFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.protab2, container, false);
    }
}
  • 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-17T10:28:26+00:00Added an answer on June 17, 2026 at 10:28 am

    Change this line and let me know if it doesn’t work:
    (from Activity to FragmentActivity)

    public class Secactivity extends FragmentActivity
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to implement the following but its not working <script> function loadmap(lat,lng) { //alert(lat,lang);
I'm trying implement my project in Apache Struts 2 but I'm not very familiar
Trying to implement 3-layer (not: tier, I just want to separate my project logically,
Trying to implement AVAudioplayer and get some metering data of the played music, but
Trying to implement the new FP 10.1 Global error handler into my projects but
I'm trying implement pull to refresh on a ListFragment but right now none of
Trying to implement Piwik using REST API over http but need a little help.
Trying to implement something similar to qtip, but using a table that compares the
Iam trying to implement JMS using eclipse.But when I tried to save the code,
I'm trying to implement paging in a custom ListAdapter. Right now I'm just making

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.