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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:37:55+00:00 2026-06-03T07:37:55+00:00

I’m so confused using ListFragment… I cant understand where is the problem… Here is

  • 0

I’m so confused using ListFragment… I cant understand where is the problem…

Here is my FragmentActivity class:

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class menu extends FragmentActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
            setContentView(R.layout.root_menu); 

        if (getSupportFragmentManager().findFragmentById(android.R.id.content) == null) {
            ListFrag list = new ListFrag();
            getSupportFragmentManager().beginTransaction().replace(android.R.id.content, list).commit();
        }}}

My ListFragment class:

public class ListFrag extends ListFragment {

    int Files = 0;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub

        getListView().setBackgroundResource(R.drawable.table);
        getListView().setDividerHeight(0);
        getListView().setCacheColorHint(0);

        View view = inflater.inflate(R.layout.main, null);

        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        setListAdapter(new CustomListAdapter(getActivity(), getThemes()));
    }

    public String[] getThemes(){
                       ...
        return ...;
    }

Also main.xml (it’s used for making list with custom list adapter i made):

<?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="wrap_content"
    android:paddingLeft="40dp"
    android:paddingTop="30dp"
    android:cacheColorHint="#00000000"
    android:layout_marginTop="100px"
     >


    <ImageView
        android:id="@+id/icon"
        android:layout_height="40dp"
        android:layout_width="40dp"
        android:src="@drawable/check" >
    </ImageView>

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:paddingTop="6dp"
        android:paddingLeft="20dp"
        android:textSize="25px" >
    </TextView>

</LinearLayout>   

This root_menu.xml should show an background image and list fragment on the top:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/back"
android:orientation="vertical"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:background="@drawable/back"
android:cacheColorHint="#00000000"
>

<fragment
      android:id="@+id/frag"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:name="com.osmgames.kartuves.ListFrag" >
</fragment>   

</LinearLayout>

This is my CustomListAdapter class:

public class CustomListAdapter extends ArrayAdapter<String> {
    private final Context context;
    private final String[] values;

    public CustomListAdapter(Context context, String[] values) {
        super(context, R.layout.main, values);
            this.context = context;
            this.values = values;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View rowView = inflater.inflate(R.layout.main, parent, false);

            TextView textView = (TextView) rowView.findViewById(R.id.label);

                ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);

                textView.setText(values[position]);

            imageView.setImageResource(R.drawable.check);

        return rowView;
    }
}

LOG:

05-07 11:49:43.017: D/AndroidRuntime(1216): Shutting down VM
05-07 11:49:43.017: W/dalvikvm(1216): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-07 11:49:43.047: E/AndroidRuntime(1216): FATAL EXCEPTION: main
05-07 11:49:43.047: E/AndroidRuntime(1216): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.osmgames.kartuves/com.osmgames.kartuves.menu}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.os.Looper.loop(Looper.java:123)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at java.lang.reflect.Method.invokeNative(Native Method)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at java.lang.reflect.Method.invoke(Method.java:521)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at dalvik.system.NativeStart.main(Native Method)
05-07 11:49:43.047: E/AndroidRuntime(1216): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.Activity.setContentView(Activity.java:1647)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at com.osmgames.kartuves.menu.onCreate(menu.java:12)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-07 11:49:43.047: E/AndroidRuntime(1216):     ... 11 more
05-07 11:49:43.047: E/AndroidRuntime(1216): Caused by: java.lang.IllegalStateException: Content view not yet created
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.support.v4.app.ListFragment.ensureList(ListFragment.java:328)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.support.v4.app.ListFragment.getListView(ListFragment.java:222)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at com.osmgames.kartuves.ListFrag.onCreateView(ListFrag.java:22)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:845)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1058)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1156)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:270)
05-07 11:49:43.047: E/AndroidRuntime(1216):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
05-07 11:49:43.047: E/AndroidRuntime(1216):     ... 20 more

I see it says that contentview is not created but i dont understand why…

  • 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-03T07:37:56+00:00Added an answer on June 3, 2026 at 7:37 am

    Well, from the logcat:

    Caused by: java.lang.IllegalStateException: Content view not yet created
    

    Your problem is here:

        getListView().setBackgroundResource(R.drawable.table);
        getListView().setDividerHeight(0);
        getListView().setCacheColorHint(0);
    
        View view = inflater.inflate(R.layout.main, null);
    

    You are trying to get the listview before you set the content view. Move the view inflation to before the getListView.

    I believe this will also fix the second error about inflating the class fragment.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.