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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:18:04+00:00 2026-06-18T05:18:04+00:00

I’m trying to use the SimpleCursorAdapter with a listView but ı couldn’t manage it.

  • 0

I’m trying to use the SimpleCursorAdapter with a listView but ı couldn’t manage it. ı’m tired of looking the bug that ı can’t find. thanks for your helps.

Here is the java code.

public class ButceGetirenListView extends ListActivity {

    ListView listLiewGetiren;
    TextView textButceGetirList1;
    TextView textButceGetirList2;
    SimpleCursorAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.butcegetir);

        listLiewGetiren=(ListView)findViewById(R.id.list);

        String[] from=new String[25];
        from[0]="asa";
        from[1]="deneme";

        int[] to={R.id.textButceGetirList1,R.id.textButceGetirList2};

        adapter=new SimpleCursorAdapter(this, R.layout.butcegetirlist, null, from, to, 0);
        listLiewGetiren.setAdapter(adapter);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.butcegiris_xml, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {
        case R.id.birinciSayfa:
             Intent intent = new Intent(ButceGetirenListView.this, Butcegiris.class);
            startActivity(intent);          return true;

        case R.id.ikinciSayfa:

            Intent intent1 = new Intent(ButceGetirenListView.this, Butcehesapla.class);
            startActivity(intent1);
            return true;

        }
        return false;
    }
    @Override
    protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();
    }
} 

and here is the error log;

02-03 20:48:10.922: E/AndroidRuntime(441): FATAL EXCEPTION: main
02-03 20:48:10.922: E/AndroidRuntime(441): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.deitel.btc/com.deitel.btc.ButceGetirenListView}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.os.Looper.loop(Looper.java:123)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ActivityThread.main(ActivityThread.java:4627)
02-03 20:48:10.922: E/AndroidRuntime(441):  at java.lang.reflect.Method.invokeNative(Native Method)
02-03 20:48:10.922: E/AndroidRuntime(441):  at java.lang.reflect.Method.invoke(Method.java:521)
02-03 20:48:10.922: E/AndroidRuntime(441):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-03 20:48:10.922: E/AndroidRuntime(441):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-03 20:48:10.922: E/AndroidRuntime(441):  at dalvik.system.NativeStart.main(Native Method)
02-03 20:48:10.922: E/AndroidRuntime(441): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ListActivity.onContentChanged(ListActivity.java:245)
02-03 20:48:10.922: E/AndroidRuntime(441):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.Activity.setContentView(Activity.java:1647)
02-03 20:48:10.922: E/AndroidRuntime(441):  at com.deitel.btc.ButceGetirenListView.onCreate(ButceGetirenListView.java:31)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-03 20:48:10.922: E/AndroidRuntime(441):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-03 20:48:10.922: E/AndroidRuntime(441):  ... 11 more

and butcegetir xml;

<?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"
    android:gravity="center" >

    <TextView
        android:id="@+id/listView"
        android:text="@string/titleButceGetir"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="15dp"
        android:gravity="center"
        android:padding="15dp" >

    </TextView>
    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="15dp"
        android:gravity="center"
        android:padding="15dp" > 
    </ListView>

</LinearLayout>

and butcegetirlist xml;

<?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="horizontal" >

    <TextView
        android:id="@+id/textButceGetirList1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_weight="1"
        android:text="@string/stringButceGetirList1" />

    <TextView
        android:id="@+id/textButceGetirList2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:layout_weight="1"
        android:text="@string/stringButceGetirList2" />

</LinearLayout>
  • 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-18T05:18:05+00:00Added an answer on June 18, 2026 at 5:18 am

    Take a look at your LogCat exception:

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

    You’re currently creating your own list ID (by using @+id) instead of using Android’s (under @android:id).

    In your XML, change android:id="@+id/list" to:

    android:id="@android:id/list"
    

    Then, in your Java file, change findViewById(R.id.list) to:

    findViewById(android.R.id.list)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
Seemingly simple, but I cannot find anything relevant on the web. What is the
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.