content must have a ListView whose id attribute is 'android.R.id.list'



Your content must have a ListView whose id attribute is 'android.R.id.list'


I'm getting this error which I have dealt with before. I have tried a bunch of different ids and so on but it's not helping. As you can see below the names do appear to be correct. I think it has something to do with the fact I am new to fragments and listfragments and so on. I have posted the relevant bits of code, if more is required I will provide it.

Any ideas?

public class DisplayInfo extends FragmentActivity { SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_info); mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); new CreateTimetablesTask().execute(); Log.d("task done", "task"); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); }


public class DummySectionFragment extends ListFragment { private Integer arrayListId; ViewGroup myViewGroup; public static final String CATEGORY_POSITION = "section_number"; public static DummySectionFragment newInstance(int pos) { DummySectionFragment f = new DummySectionFragment(); // Supply num input as an argument. Bundle args = new Bundle(); args.putInt(CATEGORY_POSITION, pos); f.setArguments(args); return f; } @Override public void onCreate(Bundle savedInstanceState) { //get the id for your array list super.onCreate(savedInstanceState); arrayListId = getArguments() != null ? getArguments().getInt(CATEGORY_POSITION) - 1 : 1; } //create the list view layout @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { myViewGroup = container; View v = inflater.inflate(R.layout.list_row, container, false); return v; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ArrayAdapter<SingleClass> arrayAdapter = new ArrayAdapter<SingleClass>(getActivity(), R.layout.fragment_display_info, android.R.id.list); setListAdapter(arrayAdapter); } }


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content"> </ListView> </LinearLayout>


<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".DisplayOnlineTimetable" > <!-- This title strip will display the currently visible page title, as well as the page titles for adjacent pages. --> <android.support.v4.view.PagerTitleStrip android:id="@+id/pager_title_strip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="#33b5e5" android:paddingBottom="4dp" android:paddingTop="4dp" android:textColor="#fff" />


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

You are giving wrong layout inside ListFragment's onCreateView method.


  • VSTS Build Nuget Packager don't work
  • Delete elements within a Linked List
  • Save/Get UIColor from UserDefaults
  • C# cannot find file specified
  • Sails.js Single Page Application (SPA) — redirect all missing/unused routes to a single controller a
  • Make List to String Python
  • Extbase TYPO3 upload image for front end user
  • How does RenderPartial figure out where to find a view?
  • Jest mock inner function
  • How to get actual line # within source (for custom logging) in TypeScript
  • Polybase create external datasource giving syntax error
  • Delphi, installers and Windows 7
  • Split text/string at closest space in Javascript
  • How To Add Chrome App Launcher 41+ updated in to ARC Welder or Add .APK in to ARC Welder
  • Filtering dataframe using hashmap
  • SAS change date format
  • When cell is selected, the backgound color of the button will change and then recorver
  • Can I augment images and masks in Keras just using flow() instead of flow_from_directory?
  • Run perl file from PHP script but not wait for output on Windows Server
  • PushPlugin not found, or is not a CDVPlugin
  • Objects Sorting With date ,Time Problem in Array(Iphone Development)
  • Problems installing Common Lisp Sketch into Windows 10
  • .Net how to set IsReadOnly for a property for a usercontrol
  • how to reload page after uploading images
  • how can i close the resultSet, prepareStatement, conn in several methods below to avoid rs close and
  • Create One-To-One relationship between table and view in EF4?
  • Python List of Tuples (Find value with key + check if exist)
  • Move elements from a listbox to another
  • jqGrid Filter Toolbar and Date and Select filters
  • Set initial vuetify v-select value
  • Building JavaFX 2.0 App on Mac, deploying on Windows
  • How to use array in autohotkey?
  • Generate and export point cloud from Project Tango
  • How to check if a database and tables exist in sql server in a vb .net project?
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • How to turn off notice reporting in xampp?
  • Functions by reference or by variable, which to use when?
  • Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner
  • Android Library Projects on Windows and Mac