It's getChildAt(i - getFirstVisiblePosition()), not +. You should also try 
to do this in the adapter's getView() as much as possible.

On Sep 28, 2008 7:23 AM, "android-noob" <[EMAIL PROTECTED]> 
wrote:


Hi,

I have a problem with activity list, setting text color. I am
downloading an XML message via HTTP server, and i've parsed and
displayed it. I want to be have a Priority Identifier for the message
that I received.

For example if value is 1, the font color is green, if 5 yellow, and
if 10 red.

I've tried the following code:

       private void setupColors() {
               for(int i=0; i<this.getListAdapter().getCount(); i++) {
                       View view = getListView().getChildAt(i +
getListView().getFirstVisiblePosition());
                       if(view == null) {
                               RLog.debug(this, "view == null");
                       }
                       if (view != null && view instanceof TextView) {
                               TextView tv = (TextView) view;
                               Registration reg = 
(Registration)listData.get(i);
                              
 tv.setBackgroundColor(Color.rgb(reg.getColor()[0], reg.getColor()
[1], reg.getColor()[2]));
                              
 tv.setTextColor(Color.rgb(reg.getFontColor()[0], reg.getFontColor()
[1], reg.getFontColor()[2]));
                       } else {
                               RLog.debug(this, "went to else...");
                       }
               }
       }

on
onStart()
onStop()
and onPostCreate(...)

But still it does not update. Worst, the value of RLog.debug messages
are always view == null.

Thanks.

-Ice



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to