listview - Android list adapter - only giving one value -


i have listview adapter takes data array , should put them listview. however, listview show 1 item array - , show in rows of listview. heres code, wrong?

arrayadapter<string> adapter = new arrayadapter<string>(getapplicationcontext(), android.r.layout.simple_list_item_2, android.r.id.text1, mainactivity.values) {               @override               public view getview(int position, view convertview, viewgroup parent) {                 view view = super.getview(position, convertview, parent);                 textview text1 = (textview) view.findviewbyid(android.r.id.text1);                 textview text2 = (textview) view.findviewbyid(android.r.id.text2);                  int = 0;                 int p = 0;                  text1.settext(mainactivity.values[i]);                 text2.settext(mainactivity.numvalues[i]);                 i++;                  return view;               }             };             listview.setadapter(adapter);             adapter.notifydatasetchanged();     } 

try replacing these lines

int = 0; int p = 0; text1.settext(mainactivity.values[i]); text2.settext(mainactivity.numvalues[i]); i++; 

with

text1.settext(mainactivity.values[position]); text2.settext(mainactivity.numvalues[position]); 

in code every time value of gets initialized 0, why see row repeated in listview


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -