[android-developers] Working with Activities
Hi,
The case is that i need to create an activity that will download some
data via http rest API. This activity will be launched from a main
activity included in a tabwidget. Really i don't have any technical
problem on how to implement it, it is not really difficult.
I have doubts on what is the best way to structure the code. My idea
is to start loading data in the onCreate method of my activity that
shows this data. So the first time this activity is shown (via
startActivity(Intent)) then start loading this data. Once this
activity is loaded first time and data is downloaded, the next times
this activity is shown i would like to use previously downloaded data.
Really it is not very difficult, as i could store this data in other
class than activity, and simply check if this data exists in the
onCreate method of activity shown. Other idea could be to keep
downloaded data in a static variable of the activity...
But really i am not sure if those options are the most natural way to
do it on Android... On other platforms i would instantiate the view
only once (activity on Android case) and show it all the times is
necessary, storing on the instance the downloaded data. After checking
activity docs, i don't see a way to reuse activity instances.. Any
time i do startactivity(intent), the activity is recreated and
onCreate called...
Any ideas or suggestions on how to do it?
Regards.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home