http://stackoverflow.com/questions/9849060/textview-settext-in-listview-causing-force-close
ArrayAdapter<String> adapter;
static final String[] COUNTRIES = new String[] {
"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
"Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
"Armenia", "Aruba", "Australia", "Austria"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.edit);
lv = (ListView) findViewById(R.id.edit_lv);
arrayList = new ArrayList<HashMap<String, String>>();
mDbHelper = new Database_creat(Show.this);
mDbHelper.Open();
adapter= new ArrayAdapter<String>
(this,ndroid.R.layout.simple_list_item_1,COUNTRIES);
lv.setAdapter(adapter);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
}
});
}
No comments:
Post a Comment