0

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

Waqar Ahmed
  • 5,005
  • 2
  • 23
  • 45
DjP
  • 4,537
  • 2
  • 25
  • 34

2 Answers2

0

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.

Community
  • 1
  • 1
Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132
  • is there any good way like instant updating like in google calendar application – DjP Mar 24 '14 at 07:04
  • If the screen turns black, what happens afterwards? – Ojonugwa Jude Ochalifu Mar 24 '14 at 07:09
  • actually I calling recreate() method of activity when new event is added to listview. – DjP Mar 24 '14 at 07:12
  • Okay look at my answer.I am editing to add a link to a question that does what you want. – Ojonugwa Jude Ochalifu Mar 24 '14 at 07:18
  • Could you descrive your system more ? Where you are adding your events ? In the web and you want to Android get only inserted events ? Or everything is working locally on Android device? – Gaskoin Mar 24 '14 at 07:22
  • You need to try what i suggested in my answers first.Since you did not post your code,all i can do is assume.Try the solution in the link i added.I am confident that would solve your problem.Or post your code – Ojonugwa Jude Ochalifu Mar 24 '14 at 07:25
  • @OjonugwaOchalifu , link you are mentioning is same as recreate activity I am asking for rather good way then recreate or calling the intent and finishing it ,,, – DjP Mar 24 '14 at 08:17
0

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.

makovkastar
  • 5,000
  • 2
  • 30
  • 50