开发者

How to implement chating application in Android

开发者 https://www.devze.com 2022-12-23 19:32 出处:网络
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 showi

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消