android - Listview not working properly -
i have listview in application. works fine when number of elements
increases on scrolling down , selecting view,it shows force close.
why so? code segment given as:
lv1 = (listview) findviewbyid(r.id.listview); lv1.setadapter(new arrayadapter<string>(this,r.layout.list_item,surveyname)); // lv1 = getlistview(); lv1.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) { listview lv = (listview) arg0; textview tv = (textview) lv.getchildat(arg2); string s = tv.gettext().tostring(); for(int i=0;i<ss;i++){ if(surveyname[i].equals(s)){ id=surveyid[i]; } } intent j=new intent(surveytool.this,survey.class); bundle d=new bundle(); d.putstring("surveyid", id); d.putstring("userid", userid); j.putextras(d); startactivity(j); } });
lv1.setadapter(new arrayadapter<string>(this,r.layout.list_item,surveyname)); replace line
madapter = new arrayadapter<string>(this,android.r.layout.simple_list_item_1,surveyname); hop working well...
Comments
Post a Comment