I put this code in the end of onCreate() method of ListActivity
ListView list=getListView();
for (int i=0;i<list.getAdapter().getCount();i++) {
TextView tv= (TextView) list.getChildAt(i).findViewById(R.id.list_item);
tv.setTextColor(Color.RED); //i simplify this string for example
}
it doesn’t work because ListView has no childs yet – it’s size 0; however .getAdapter().getCount() returns not 0.
What should i use instead of list.getChildAt(i) to make this code correct?
UPDATE: i think, this is what i need Formatting ListView Content During onCreate() method (getting ListView children)
but i don’t get the solution of that problem
The view is added to the adapter so instead of
list.getChildAt(i)uselv.getAdapter().getView(i, null, null)to get the view