Sunday, January 19, 2014

Multithreading dynamically change the color of the ListView Button


            
Such as the title, and now I use the interface to achieve a listView display multiple rows of data, then the data behind each will have a Button, used for submission of data.
I use Button after submitting his data in another thread waiting for a reply message, and then receive the information I wanted to change this line data corresponding Button color, is there any big God can give a solution.
Reply:
After submitting his data put together this list of the index reached the sub-thread after thread and other processed through the handler returns to the main thread, and change the color of the button on it, since the beginning to get a list of the index, so record button to change the color of the piece easy
Reply:
First, it requires binding listview button color data, when the data changes the color of the button, the call like the following phrase refresh:
listItemAdapter.notifyDataSetChanged ();
Reply:
cited a floor kouwoo reply:
submitted his data to the list after the index reached together with the child thread, etc. After threading through the handler returns processed to the main thread, and change the color of the button on it, since the beginning to get a list of the index, so changing the color of that record button on the easy

But my button is GetView in BaseAdapter instantiation out of local variables, my hanler defined in the Activity's onCreate function, I can not get that button ah
Reply:
With a map to an int value BUTTON and saved it. Detection int value determines whether to change the corresponding button. .
Reply:
references, 4th Floor afairycell reply:
with a map to an int value BUTTON and saved it. Detection int value determines whether to change the corresponding button. .


Is not necessary to change the color of the button needs to be saved to the ah Adapter
Reply:
Is this meant. This will be no problem with threads judge this Adapter change button color on it.

No comments:

Post a Comment