开发者

Save UI and data in android

开发者 https://www.devze.com 2023-04-02 11:56 出处:网络
I am working on a messenger type application,when a user click on a user from chat window I show a blank Layout with a send button and EditText at bottom,now when user type text in Edit Field and clic

Save UI and data in android

I am working on a messenger type application,when a user click on a user from chat window I show a blank Layout with a send button and EditText at bottom,now when user type text in Edit Field and click on send I create a dynamic Layout hol开发者_如何学Goding some dynamically created other UI component like Label and ImageView etc.now I want to save this UI state when user press back button or home button.I know there is a method for activity like SaveInstance etc it save only data object but here I want to save GUI with data for all chat windows,anyone can guide how I can handle this ?I will be very thankful for guidance. .


You're doing it wrong.

You should be storing your data in some place (in memory, like in a static array somewhere, or in sql if you need to keep it across sessions), and displaying a listView with an adapter on this data. then, when adding data, you only need to notify your adapter to refresh the view.

0

精彩评论

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