I am developing one chat form in my apps displying the chats I was taken linear laout but I need to refresh that chat msg every 5 seconds for that I am using timer.while dynamically adding it is showing getting values from db and add to layout but in gui I am not able to get those messages for that what I have to do. is there any way for chat application 开发者_开发问答refreshing page. how to update the values to layout in Android .pl
I'm not sure, that i understand right.
To update Layout information you can use findViewById(int). This is Method return View object. Then cast it to those real class. for examle:
TextView tv = (TextView) findViewById(R.id.TextView1);
To update this fields, use: tv.setText("Hello!");
There is no need, to "refresh page". You can use sockets and update fields when server replies (Using socket Events).
精彩评论