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

  • Home
  • SEARCH
  • 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 7584507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:56:17+00:00 2026-05-30T18:56:17+00:00

I am posting here a logcat file. How can I solve the runtimeException error.

  • 0

I am posting here a logcat file. How can I solve the runtimeException error. Logcat is showing this error:

03-03 03:12:30.716: E/AndroidRuntime(880): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.example.FirstProject/com.example.FirstProject.City}:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is ‘android.R.id.list’
Logcat:

03-03 03:46:30.607: D/AndroidRuntime(908): Shutting down VM
03-03 03:46:30.607: W/dalvikvm(908): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-03 03:46:30.657: E/AndroidRuntime(908): FATAL EXCEPTION: main
03-03 03:46:30.657: E/AndroidRuntime(908): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.FirstProject/com.example.FirstProject.City}:                 java.lang.RuntimeException: Your content must have a ListView whose id attribute is     'android.R.id.list'
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-03 03:46:30.657: E/AndroidRuntime(908):  at     android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.os.Looper.loop(Looper.java:123)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.ActivityThread.main(ActivityThread.java:4627)
03-03 03:46:30.657: E/AndroidRuntime(908):  at java.lang.reflect.Method.invokeNative(Native Method)
03-03 03:46:30.657: E/AndroidRuntime(908):  at java.lang.reflect.Method.invoke(Method.java:521)
03-03 03:46:30.657: E/AndroidRuntime(908):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-03 03:46:30.657: E/AndroidRuntime(908):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-03 03:46:30.657: E/AndroidRuntime(908):  at dalvik.system.NativeStart.main(Native Method)
03-03 03:46:30.657: E/AndroidRuntime(908): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.ListActivity.onContentChanged(ListActivity.java:245)
03-03 03:46:30.657: E/AndroidRuntime(908):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.Activity.setContentView(Activity.java:1647)
03-03 03:46:30.657: E/AndroidRuntime(908):  at com.example.FirstProject.City.onCreate(City.java:23)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-03 03:46:30.657: E/AndroidRuntime(908):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-03 03:46:30.657: E/AndroidRuntime(908):  ... 11 more

Code for class from where I am calling city.class:

package com.example.FirstProject;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;

//import android.widget.EditText;
//import android.widget.RadioButton;
//import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class FirstProjectActivity extends Activity {
/** Called when the activity is first created. */
protected ListAdapter adapter;
Cursor cursor;
 protected String[] cities = {"Mumbai"};
 ListView lv ;
 ListView stations;

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

    /* lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {
         public void onItemClick(AdapterView<?> parent, View view,
             int position, long id) {

             // When clicked, Open the Next Screen

            if(position==0)
            {

            }

            }
    });*/
}


public void myClickHandler(View view)
{
    Toast.makeText(this, "button clicked",Toast.LENGTH_LONG).show();

     /*setContentView(R.layout.screen1);
     ListAdapter adapter = new ArrayAdapter<String>(this,     android.R.layout.simple_list_item_1, cities);
     ListView FirstProjectActivity = (ListView) findViewById(R.id.mylist1);
     FirstProjectActivity.setAdapter(adapter);*/
     Intent i=new Intent(this,City.class);
     i.setClass(this,City.class);
     startActivity(i);

}
/*public void onListItemClick(ListView parent, View view, int position, long id) {
      //  super.onListItemClick(parent, view, position, id);
        Toast.makeText(this, "yesss",Toast.LENGTH_LONG).show();
       Intent intent = new Intent(this, List.class);
        Cursor cursor = (Cursor) adapter.getItem(position);
        intent.putExtra("tn", cursor.getInt(cursor.getColumnIndex("_id")));
        startActivity(intent);
    }*/
}

Code for the city.class to which I am calling:

package com.example.FirstProject;

import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class City extends ListActivity{

protected ListAdapter adapter;
Cursor cursor;
protected String[] cities = {"Mumbai"};

 @Override
    public void onCreate(Bundle savedInstanceState)
 {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.screen1);
     ListAdapter adapter = new ArrayAdapter<String>(this,      android.R.layout.simple_list_item_1, cities);
     ListView FirstProjectActivity = (ListView) findViewById(R.id.mylist1);
     FirstProjectActivity.setAdapter(adapter);

 }

 public void onListItemClick(ListView parent, View view, int position, long id) {
        super.onListItemClick(parent, view, position, id);
        Toast.makeText(this, "yesss",Toast.LENGTH_LONG).show();
        Intent intent = new Intent(this, List.class);
        Cursor cursor = (Cursor) adapter.getItem(position);
        intent.putExtra("tn", cursor.getInt(cursor.getColumnIndex("_id")));
        startActivity(intent);
    }
 }
  • 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-05-30T18:56:18+00:00Added an answer on May 30, 2026 at 6:56 pm
    ListView FirstProjectActivity = (ListView) findViewById(R.id.mylist1);
    

    change this to

      ListView FirstProjectActivity = (ListView) findViewById(R.id.list);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First time posting here, will try to be succinct. This is a classic 'can't
this is my 1st time posting here, so thanks to everyone who can give
this is my first time posting here, I have a question which I have
I am bouncing between posting this here and on Superuser. Please excuse me if
It might be a long shot posting this question here but we will see.
This has been driving me nuts, I'm posting here after a lot of looking
this is my first time posting here, but I didn't know where else to
This is my first time posting here, but I've found a lot of answers
I'm going nuts on this. (as most people posting here lol) I have a
This is fairly 'math-y' but I'm posting here because it's a Project Euler problem,

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.