开发者

Keeping a bitmap in memory with the help of onRetainNonConfigurationInstance()

开发者 https://www.devze.com 2023-01-08 11:05 出处:网络
I have a large bitmap that i wo开发者_JS百科uld like to keep in memory when the qwerty keyboard is visible. My app is always in landscape, so this is the only configuration change that will cause a re

I have a large bitmap that i wo开发者_JS百科uld like to keep in memory when the qwerty keyboard is visible. My app is always in landscape, so this is the only configuration change that will cause a reDraw. I heard this is what onRetainNonConfigurationinstance() is for...but cant figure it out. Can someone point me in the right direction? Thanks.


try

    @Override
public Object onRetainNonConfigurationInstance() {
    return bitMap;
}

in onCreate call getLastNonConfigurationInstance(); to recive the bitmap

I hade a smilare read about it Save cache when rotate device

0

精彩评论

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