diff options
author | Kamal Negi <kamaln@codeaurora.org> | 2016-03-30 10:30:33 +0530 |
---|---|---|
committer | Abhisek Devkota <ciwrl@cyanogenmod.com> | 2016-04-19 20:40:06 -0700 |
commit | 836e8dc262d13eee0679986ceae5eda204d3c433 (patch) | |
tree | f8ac2c48b94ba37467439afd0af0f153bba08c35 | |
parent | 220242cbb65ead86adbae29eb8e4edaf94162679 (diff) | |
download | android_hardware_qcom_fm-836e8dc262d13eee0679986ceae5eda204d3c433.tar.gz android_hardware_qcom_fm-836e8dc262d13eee0679986ceae5eda204d3c433.tar.bz2 android_hardware_qcom_fm-836e8dc262d13eee0679986ceae5eda204d3c433.zip |
Handle orientation change in FM app
A configuration change (such as a change in screen orientation,
language, input devices, etc) causes current activity to be
destroyed, going through the activity lifecycle process of
onPause(), onStop(), and onDestroy() as appropriate. If the
activity had been in the foreground or visible to the user,
once onDestroy() is called in that instance then a new instance
of the activity will be created.
Change will ensure that activity doesn't get restarted on
orientation configuration changes.
Change-Id: Ie991c90528834dd6106a586dccdd20a11a701fab
-rw-r--r-- | fmapp2/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | fmapp2/src/com/caf/fmradio/FMRadio.java | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/fmapp2/AndroidManifest.xml b/fmapp2/AndroidManifest.xml index bfd6369..06942b4 100644 --- a/fmapp2/AndroidManifest.xml +++ b/fmapp2/AndroidManifest.xml @@ -65,6 +65,7 @@ android:screenOrientation="portrait" android:allowTaskReparenting="true" android:launchMode="singleTask" + android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/FMTheme" android:excludeFromRecents="false" > diff --git a/fmapp2/src/com/caf/fmradio/FMRadio.java b/fmapp2/src/com/caf/fmradio/FMRadio.java index 1d431f0..5009286 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadio.java +++ b/fmapp2/src/com/caf/fmradio/FMRadio.java @@ -42,6 +42,7 @@ import android.content.DialogInterface.OnKeyListener; import android.content.Intent; import android.content.IntentFilter; import android.content.BroadcastReceiver; +import android.content.res.Configuration; import android.media.AudioSystem; import android.media.AudioManager; import android.media.MediaRecorder; @@ -443,6 +444,12 @@ public class FMRadio extends Activity } @Override + public void onConfigurationChanged(Configuration newConfig) { + Log.d(LOGTAG, "onConfigurationChanged"); + super.onConfigurationChanged(newConfig); + } + + @Override public void onRestart() { Log.d(LOGTAG, "FMRadio: onRestart"); try { |