Вопрос

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