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

