Hi Mukhesh ,

I did the same as shown in the example.. but its throwing exception saying..
11-28 04:11:14.541: E/AndroidRuntime(594): java.lang.RuntimeException:
Unable to start activity ComponentInfo{com.ta.coe/com.ta.coe.DataListView}:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list'

JAVA Code:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.data_list_view);
ListView lView = (ListView)findViewById(android.R.id.list);
ArrayList<String> values=new DBOpenHelper(this).buildListForHeadingData();
lView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, values));
//setListAdapter(adapter);
lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
===============
XML FIle (data_list_view)
<?xml version="1.0" encoding="utf-8"?>
<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="@+id/list"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0"
/>
</LinearLayout>

Can you tell me how to resolve this problem.

Thanks,
KIRANKUMARKENDOLE


On Mon, Nov 28, 2011 at 3:25 AM, Mukesh Srivastav <[email protected]>wrote:

> check this out.
>
> http://www.androidpeople.com/android-listview-multiple-choice-example
>
>
> Warm Regards,
> *Mukesh Kumar*,
> Android Consultant/Freelancer,
> India,Hyderabad.
>
> On Mon, Nov 28, 2011 at 1:35 PM, Kiran Kumar Kendole <
> [email protected]> wrote:
>
>> Thanks a lot Mukhesh. Yes I can see boxes.
>> But when we click on the checkboxes.. its not happening check/un check.
>> Do we need to add any code for this?
>>
>> Thanks,
>> KIRANKUMARKENDOLE
>>
>>
>> On Mon, Nov 28, 2011 at 12:41 AM, Mukesh Srivastav 
>> <[email protected]>wrote:
>>
>>> For CheckBox,
>>>
>>> Replace the simple_list_item_1.xml  with the below one.
>>>
>>> android.R.layout.simple_list_item_multiple_choice
>>>
>>> Warm Regards,
>>> *Mukesh Kumar*,
>>> Android Consultant/Freelancer,
>>> India,Hyderabad.
>>>
>>> On Mon, Nov 28, 2011 at 10:50 AM, Kiran Kumar Kendole <
>>> [email protected]> wrote:
>>>
>>>> Hi Mukhesh ,
>>>>
>>>> Thanks for your post. Its worked fine. But I have a small Q in addition
>>>> with this.
>>>> Because I have one user defined layout , so I used data_item_list XML
>>>> file. In that I want to show a CheckBox for each List item and a "ADD DATA"
>>>> button after the end of the List.
>>>>
>>>> Can you please let me know how to edit this XML file..
>>>> simple_list_item_1.xml file?
>>>>
>>>> Thanks,
>>>> KIRANKUMARKENDOLE
>>>>
>>>>
>>>>
>>>> On Sun, Nov 27, 2011 at 11:59 PM, Mukesh Srivastav <
>>>> [email protected]> wrote:
>>>>
>>>>> Change this line in the adapter.
>>>>>
>>>>> Replace your code Adapet line with the below one.
>>>>>
>>>>>
>>>>> lv1.setAdapter(new
>>>>> ArrayAdapter<String>( android.R.layout.simple_list_item_1 , lv_arr));
>>>>>
>>>>>
>>>>> Warm Regards,
>>>>> *Mukesh Kumar*,
>>>>> Android Consultant/Freelancer,
>>>>> India,Hyderabad.
>>>>>
>>>>>
>>>>>
>>>>>  On Mon, Nov 28, 2011 at 9:53 AM, Kiran Kumar Kendole <
>>>>> [email protected]> wrote:
>>>>>
>>>>>>  Hi Guys..
>>>>>> this is my code... I want to show a set of strings as List. But its
>>>>>> not working for me.. and showing exceptions.. can anybody help me.
>>>>>>
>>>>>> JAVA file:
>>>>>>
>>>>>> package com.ta.coe;
>>>>>>
>>>>>> import android.app.Activity;
>>>>>> import android.app.ListActivity;
>>>>>> import android.os.Bundle;
>>>>>> import android.view.View;
>>>>>> import android.widget.ArrayAdapter;
>>>>>> import android.widget.ListView;
>>>>>> import android.widget.Toast;
>>>>>>
>>>>>> public class DataListView extends ListActivity{
>>>>>> private ListView lv1;
>>>>>> private String lv_arr[]= new
>>>>>> String[]{"Android","iPhone","BlackBerry","AndroidPeople"};
>>>>>>  @Override
>>>>>> public void onCreate(Bundle icicle)
>>>>>> {
>>>>>>  super.onCreate(icicle);
>>>>>> setContentView(R.layout.data_list_view);
>>>>>> lv1=(ListView)findViewById(R.id.list);
>>>>>>  // By using setAdpater method in listview we an add string array in
>>>>>> list.
>>>>>> lv1.setAdapter(new ArrayAdapter<String>(this,R.id.list , lv_arr));
>>>>>>  }
>>>>>> }
>>>>>> =================================
>>>>>> XML File:
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <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="@+id/list"
>>>>>> android:orientation="vertical"
>>>>>>  android:layout_width="fill_parent"
>>>>>> android:layout_height="0dip"
>>>>>>  android:layout_weight="1.0"
>>>>>> />
>>>>>> </LinearLayout>
>>>>>>
>>>>>> Please send me the correct code..
>>>>>>
>>>>>> Thanks
>>>>>> KIRANKUMARKENDOLE
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Android Developers" group.
>>>>>> To post to this group, send email to
>>>>>> [email protected]
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Android Developers" group.
>>>>> To post to this group, send email to
>>>>> [email protected]
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Android Developers" group.
>>>> To post to this group, send email to
>>>> [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-developers?hl=en
>>>>
>>>
>>>
>>>
>>> --
>>> Warm Regards,
>>> *Mukesh Kumar*,
>>> Android Consultant/Freelancer,
>>> India,Hyderabad.
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> --
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to