开发者

Why exactly is onFreeze() used for?

开发者 https://www.devze.com 2023-01-07 16:32 出处:网络
In one Android Tutorial I saw the usage of this function. There he uses it for resuming the previous session of the application I think, but the problem is that I cannot ovveride this function in my c

In one Android Tutorial I saw the usage of this function. There he uses it for resuming the previous session of the application I think, but the problem is that I cannot ovveride this function in my class and both classes (min开发者_如何转开发e & his) extend from ListActivity.

@Override
    protected void onFreeze(Bundle outState) {
        super.onFreeze(outState);
        outState.putLong("feed_id", feed.feedId);
        outState.putString("title", feed.title);
        outState.putString("url", feed.url.toString());
    }

Also I had some problem with some of the function calls before that, like for manipulating ArrayLists he calls list.next() & I don't have such function so I used list.MoveToNext(). Could be this because of a different version of Android (I use 1.6) and what to use as a replace for this function?


I think this tutorial is very, very old. Actually, the onFreeze() method isn't used anymore. From the (August 2008) Android 0.9 SDK Beta release notes:

onFreeze(Bundle) renamed to onSaveInstanceState(Bundle), to better reflect the fact that it does not represent an actual change in application lifecycle


You're Right Friend,it is renamed to

@Override 

onSaveInstanceState(Bundle outState)

{

//TODO auto generated block

super.onSaveInstanceState(outState);

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号