Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ユーザーが保存したいテキストを入力し、画面が回転したときに再挿入したとします。アクティビティが破棄される前にonConfigurationChanged()が呼び出されるので、このメソッドにテキストを保存してonRestart()に設定できますか?
メソッドを使用onSaveInstanceState()して必要な値を保存し、画面の向きの後に にsavedInstance渡されたパラメーターを使用できますonCreate(Bundle savedInstance)。onConfigurationChanged(Configuration newConfig)構成の変更を自分で処理している場合、つまりメソッドをオーバーライドしている場合は呼び出されず、提案どおりにonCreate使用できます。onRestoreInstanceState()
onSaveInstanceState()
savedInstance
onCreate(Bundle savedInstance)
onConfigurationChanged(Configuration newConfig)
onCreate
onRestoreInstanceState()