I am currently working on calendar application , in which when I add a event which is added in google calendar to show that event instantly on screen I am using recreate() method of activity which fetches all event and display it again but while this process screen turn in black , which is vary bad UI experience , how I can solve this issue , I want something like google calendar where events are instantly added. thanks

有帮助吗?

解决方案

If your calendar uses an adapter for displaying items you can change the data in the adapter and invoke adapter.notifyDataSetChanged(). It notifies the attached observers that the underlying data has been changed and any View reflecting the data will be refreshed with the new values from the adapter.

其他提示

Use ProgressDialog to keep the user "engaged" while you fetch new Calendar data and then take a look at this Should give you an idea of how to recreate an Activity.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top