简体   繁体   中英

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

I have a large bitmap that i would 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM