good?:
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putInt("counter", counter);
savedInstanceState.putInt("counter_foe", counter_foe);
super.onSaveInstanceState(savedInstanceState);
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
counter = savedInstanceState.getInt("counter");
counter_foe = savedInstanceState.getInt("counter_foe");
}
On aug. 7, 18:47, TreKing <treking...@gmail.com> wrote:
> On Sun, Aug 7, 2011 at 1:01 PM, Zwiebel <hunzwie...@gmail.com> wrote:
> > My problem is the following:
> > I want to keep my counter's and my counter_foe's content through the
> > activity changes. I don't want them to be the default (0) texts. For
> > example:
> > If I clicked on the next button of mine activity, then I called
> > startActivityForResult, and the another activity started. When I click
> > in the second activity on one of the possibilities, the first activity
> > created again. But with the main content (what is 0), and not with the
> > 1, or 2, or 3 etc. How can I keep these contents and return them
> > everytime when the s activity resumed?
>
> I didn't look at you code, but look at the docs. The section on Activity
> Lifecyle and in particular onSaveInstanceState and onRestoreInstanceState.
>
> --------------------------------------------------------------------------- ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
--
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
No comments:
Post a Comment