• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is there a "refresh" ability on an activity?

 
Ranch Hand
Posts: 231
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an activity, inside the onCreate() method it pulls some data from another class

That data might change, how can I refresh it? Do I need to call onCreate() somehow, or is there an easier way?
 
Ranch Hand
Posts: 127
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,James

James Elsey : how can I refresh it? Do I need to call onCreate()



you can't call onCreate() method that is Andoird life cycle method. that is being managed by Android OS.

To get refreshed data from another class you can put the code inside onStart() method. that is being called after onCreate().

Go through Android Life Cycle

Thanks :-)

 
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that an Activity is created, started, resumed,paused, stopped or destroyed automatically by the system depending on events generated by user. There are callbacks with similar names that help you setup your activity and do what you wish to do across activity life cycle.
What you are referring to is refreshing your data set/data store. There is a subtle difference between the two.

You can refresh your data set any time you wish(by calling appropriate method on your data store instance). And if you do it inside correct Activity life cycle method, your users will see updated data every time.

For e.g.: onResume() is called whenever an Activity is brought to the front. So, if you refresh your data set in onResume() the user will see updated view every time.
 
reply
    Bookmark Topic Watch Topic
  • New Topic