Simple List single choice
package app.test;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Test extends Activity {
ListView listView;
private String[] data = { "1", "2","3", "4", "5","6", "7","8" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
listView = new ListView(this);
// listView.setAdapter(new ArrayAdapter<String>(this,
// android.R.layout.simple_list_item_1, data));
listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_single_choice, data));
listView.setItemsCanFocus(true);
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
setContentView(listView);
}
}
Related examples in the same category