My app i'm currently developing needs to refresh a Linear Layout that i'm dynamically adding Views too. I currently am adding all of the Views within the UI thread but have a separate Dialog class which upon a button click within the Dialog will need to refresh/Re draw the Linear Layout. Is there a way I can ref开发者_高级运维resh the Linear Layout within a different class (trying to stay very object oriented in my program design) or a way to use a game loop for a Linear Layout to refresh the View every 3 seconds? Thanks!
I'm pretty sure you don't need to manually "redraw" anything. As soon as you change the contents of your layout (and as soon as android can get around to it (which will be a LOT faster than 3 seconds)) you'll see the updated screen. As to what thread you do this from, you can only change your layouts from the main thread, as far as I know, but you can call Runnable methods in that thread via a handler from anywhere.
精彩评论