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

The Archive Base Latest Questions

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

I’ve found the following example in this link but when I run it I

  • 0

I’ve found the following example in this link but when I run it I get force close,I don’t know the reason,would you please help me on this issue?and also explain a little about People,they are strikethrough and there is a warning that People is deprecated! I’m really new in android and java programming,please help me,any suggestions will be appreciated.

Here are the codes:

list.xml

        <?xml version="1.0" encoding="utf-8"?>
        <!-- This file is at /res/layout/list.xml -->
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="fill_parent"  android:layout_height="fill_parent">

            <ListView android:id="@android:id/list"
                android:layout_width="fill_parent"  android:layout_height="0dip"
                android:layout_weight="1" />

            <Button android:id="@+id/btn" android:onClick="doClick"
             android:layout_width="wrap_content"  android:layout_height="wrap_content"
             android:text="Submit Selection" />

        </LinearLayout>

Test class

 package com.example.multicolumnlistview;    
    import android.app.ListActivity;
    import android.database.Cursor;
    import android.os.Bundle;
    import android.provider.Contacts.People;
    import android.util.Log;
    import android.util.SparseBooleanArray;
    import android.view.View;
    import android.widget.ListView;
    import android.widget.SimpleCursorAdapter;     
    public class Test extends ListActivity
    {
        private static final String TAG = "ListViewActivity3";
        private ListView lv = null;
        private Cursor cursor = null;
        private int idCol = -1;
        private int nameCol = -1;
        private int notesCol = -1;     
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);     
            lv = getListView();             
            cursor = managedQuery(People.CONTENT_URI, 
                            null, null, null, People.NAME);     
            String[] cols = new String[]{People.NAME};
            idCol = cursor.getColumnIndex(People._ID);
            nameCol = cursor.getColumnIndex(People.NAME);
            notesCol = cursor.getColumnIndex(People.NOTES);             
            int[] views = new int[]{android.R.id.text1};             
            SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
                android.R.layout.simple_list_item_multiple_choice,
                cursor, cols, views);             
            this.setListAdapter(adapter);             
            lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
        }         
        public void doClick(View view) {
            int count=lv.getCount();
            SparseBooleanArray viewItems = lv.getCheckedItemPositions();
            for(int i=0; i<count; i++) {
              if(viewItems.get(i)) {
                cursor.moveToPosition(i);
                long id = cursor.getLong(idCol);
                String name = cursor.getString(nameCol);
                String notes = cursor.getString(notesCol);
                Log.v(TAG, name + " is checked. Notes: " + notes +
                    ". Position = " + i + ". Id = " + id);
              }
            }
        }
    }

and here is the logcat:

02-04 09:04:59.609: E/DatabaseUtils(99):    at android.os.Binder.execTransact(Binder.java:287)
02-04 09:04:59.609: E/DatabaseUtils(99):    at dalvik.system.NativeStart.run(Native Method)
02-04 09:04:59.619: D/ddm-heap(139): Got feature list request
02-04 09:04:59.628: D/AndroidRuntime(220): Shutting down VM
02-04 09:04:59.628: W/dalvikvm(220): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
02-04 09:04:59.628: E/AndroidRuntime(220): Uncaught handler: thread main exiting due to uncaught exception
02-04 09:04:59.639: E/AndroidRuntime(220): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.multicolumnlistview/com.example.multicolumnlistview.Test}: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://contacts/people from pid=220, uid=10029 requires android.permission.READ_CONTACTS
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.os.Looper.loop(Looper.java:123)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.ActivityThread.main(ActivityThread.java:4363)
02-04 09:04:59.639: E/AndroidRuntime(220):  at java.lang.reflect.Method.invokeNative(Native Method)
02-04 09:04:59.639: E/AndroidRuntime(220):  at java.lang.reflect.Method.invoke(Method.java:521)
02-04 09:04:59.639: E/AndroidRuntime(220):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-04 09:04:59.639: E/AndroidRuntime(220):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-04 09:04:59.639: E/AndroidRuntime(220):  at dalvik.system.NativeStart.main(Native Method)
02-04 09:04:59.639: E/AndroidRuntime(220): Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://contacts/people from pid=220, uid=10029 requires android.permission.READ_CONTACTS
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.os.Parcel.readException(Parcel.java:1218)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:160)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.content.ContentProviderProxy.bulkQuery(ContentProviderNative.java:326)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.content.ContentProviderProxy.query(ContentProviderNative.java:345)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.content.ContentResolver.query(ContentResolver.java:202)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.Activity.managedQuery(Activity.java:1495)
02-04 09:04:59.639: E/AndroidRuntime(220):  at com.example.multicolumnlistview.Test.onCreate(Test.java:30)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-04 09:04:59.639: E/AndroidRuntime(220):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
02-04 09:04:59.639: E/AndroidRuntime(220):  ... 11 more
02-04 09:04:59.649: I/Process(51): Sending signal. PID: 220 SIG: 3
02-04 09:04:59.659: I/dalvikvm(220): threadid=7: reacting to signal 3
02-04 09:04:59.659: E/dalvikvm(220): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
02-04 09:04:59.739: D/ddm-heap(110): Got feature list request
02-04 09:04:59.769: D/ddm-heap(175): Got feature list request
02-04 09:04:59.779: I/ARMAssembler(51): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x345958:0x345a14] in 388876 ns
02-04 09:04:59.788: I/ARMAssembler(51): generated scanline__00000177:03515104_00001001_00000000 [ 91 ipp] (114 ins) at [0x345a18:0x345be0] in 434133 ns
02-04 09:04:59.849: D/ddm-heap(209): Got feature list request
02-04 09:04:59.979: D/ddm-heap(200): Got feature list request
02-04 09:05:08.918: W/ActivityManager(51): Launch timeout has expired, giving up wake lock!
02-04 09:05:09.202: W/ActivityManager(51): Activity idle timeout for HistoryRecord{44e4c570 com.example.multicolumnlistview/.Test}
  • 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:03:50+00:00Added an answer on June 18, 2026 at 5:03 am

    As you are reading the contacts of the device you need to add the READ_CONTACT permission in your manifest file.

     <uses-permission android:name="android.permission.READ_CONTACTS"/>
    

    I think this is the issue only.

    EDITED:

    Check the below links for the Listview with Checkbox .

    1) Link 1
    2) Link 2
    3) Link 3

    • 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
For some reason, after submitting a string like this Jack’s Spindle from a text
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.