android - Listview background color not getting updated -


i have following listview:

<listview         android:id="@+id/listview1"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignleft="@+id/textview1"         android:layout_below="@+id/textview1" >     </listview> 

i want update background color of first nth columns.

for using:

int numofmessages=lst.length-lstnew.length;   arrayadapter<string> adpt = new arrayadapter<string>(messages.this, android.r.layout.simple_list_item_1,lst); lm.setadapter(adpt); (int i=1;i<numofmessages;i++) { tv.settext("welcome " + i); lm.getchildat(i).setbackgroundcolor(color.blue); tv.settext("welcome :  " + i); } 

but there wrong line:

lm.getchildat(i).setbackgroundcolor(color.blue); 

because after control not moving further.

please me change background color of textview dynamicaly.

you can by:

arrayadapter<string> adpt = new arrayadapter<string>(messages.this, android.r.layout.simple_list_item_1,lst){         @override         public view getview(int position, view convertview, viewgroup parent) {             view v = super.getview(position, convertview, parent);             if(position==2){             v.setbackgroundcolor(color.blue);             }else if(position==4){             v.setbackgroundcolor(color.red);             }              return v;         }     }; 

something row want....


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -