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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:21:36+00:00 2026-06-06T03:21:36+00:00

I’m trying to get my ArrayList of HashMaps to try to get a working

  • 0

I’m trying to get my ArrayList of HashMaps to try to get a working ListAdapter. When I run this, I’m getting a

java.lang.RuntimeException: Your content must have a ListView whose id attribute is android.R.id.list

error. Here’s what I have:

gameList is where I’m getting my data from:

gameList.toString() returns: [{turn=1, opponent=UserTwo, streak=4, hintX=1234, player=UserOne, solution=MySolution, hintY=5678}, {turn=0, opponent=UserThree, streak=12, hintX=1344, player=UserOne, solution=SolutionTwo, hintY=5428}]

My ListActivity class:

public class GameListActivity extends ListActivity{

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

    String GAME_ITEM = "game";
    String PLAYER_ITEM = "player";
    String OPPONENT_ITEM = "opponent";
    String SOLUTION_ITEM = "solution";
    String HINTX_ITEM = "hintX";
    String HINTY_ITEM = "hintY";
    String STREAK_ITEM = "streak";
    String TURN_ITEM = "turn";

ArrayList<HashMap<String, String>> gameList = new ArrayList<HashMap<String, String>>();
AppVars gameVars = ((AppVars) getApplicationContext());
gameList = gameVars.getState();

String[] keyList = new String[] { OPPONENT_ITEM, STREAK_ITEM, TURN_ITEM };

ListAdapter adapter = new SimpleAdapter(this, gameList, R.layout.game_list_item, 
                        keyList, 
                        new int[] {R.id.opponent, R.id.streak, R.id.turn});
setListAdapter(adapter);        

}   

XML:

game_list_item.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="5dp" >

    <ImageView
        android:id="@+id/thumbnail"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        android:src="@android:drawable/alert_dark_frame" />

    <TextView
        android:id="@+id/opponent"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/thumbnail"
        android:layout_centerHorizontal="true"
        android:text="Entry"
        android:textSize="30sp" />

    <TextView
        android:id="@+id/streak"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/thumbnail"
        android:layout_centerHorizontal="true"
        android:text="Streak"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/turn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/streak"
        android:layout_centerHorizontal="true"
        android:text="Your turn!"
        android:textSize="20sp" />

</RelativeLayout>

game_list.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/blackboard" >

    <ListView
        android:id="@+id/gameList"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" >
    </ListView>

</RelativeLayout>
  • 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-06T03:21:38+00:00Added an answer on June 6, 2026 at 3:21 am

    java.lang.RuntimeException: Your content must have a ListView whose id
    attribute is android.R.id.list

    So error log tells you everything

    You need to add to your XML file of ListView android.R.id.list

    <ListView
       android:id="@android:id/list"
       // next attributes
    />
    

    Exactly when your Activity extends from ListActivity, you should to use this.

    Here is info from docs

    ListActivity has a default layout that consists of a single,
    full-screen list in the center of the screen. However, if you desire,
    you can customize the screen layout by setting your own view layout
    with setContentView() in onCreate(). To do this, your own view MUST
    contain a ListView object with the id “@android:id/list” (or list if
    it’s in code)

    So for more information have look at ListActivity.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to run a str_replace or preg_replace which looks for certain words

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.