Is that possible to check was onCreate called because of orientation change?

后端 未结 8 1522
甜味超标
甜味超标 2020-12-06 00:08

I need to act differently in onStart() method depending on how onCreate() was called in result of orientation change or not. Is that

8条回答
  •  一个人的身影
    2020-12-06 00:34

    Following Nahtan's idea I wrote this:

    in onCreate():

    if ( (oldConfigInt & ActivityInfo.CONFIG_ORIENTATION)==ActivityInfo.CONFIG_ORIENTATION ) {
        // ... was rotated
    } else {
        // ... was not rotated
    }
    

    in onDestroy():

    super.onDestroy();
    oldConfigInt = getChangingConfigurations();
    

提交回复
热议问题