on Android configuration changed Application is restarting -


I'm a newbie for Android development. I am writing an application and my requirement is when the orientation changes. , The application does not restart below is a sampling app tested in Samsung Galaxy II mobile.

I am using 4.0.4 Android OS version, and my application has been developed under API level 8.

  android: configChanges = "orientation | keyboard | keyboardHidden" Android: configChanges = "orientation | keyboard" Android: configChanges = "orientation" Android: configChanges = "Keyboard | keyboardHidden" android: configChanges = "orientation | keyboardHidden"   

Please help me

  Increases the MainActivity activity of the public class {@Override Creates Public Void (Bundle Saved Instantstate) {Super.New (Saved Instantstate); SetContentView (R.layout.activity_main); Toast. Make text (getApplicationContext), "it is starting", toast.lnnhH_LOG). Show (); } @ Override Public Boolean On Crate Option Menu (menu menu) {getMenuInflater (). Flood (R. menu activation_men, menu); Back true; } @ Override converting configuration to public Zero (Configuration new config) {super.onConfigurationChanged (newConfig); If (newConfig.orientation == configuration.ORIENTATION_PORTRAIT) {Toast. Maketext (This, "Portrait", Toast. LNNGHARART) Show (); //setContentView (R.layout.activity_main); } If (newConfig.orientation == configuration.ORIENTATION_LANDSCAPE) {Toast. Maketext (this, "Landscape", Toast. LNNGHHORT). Show (); //setContentView (R.layout.activity_main); }}}   

and my main file
  & lt; Manifest xmlns: android = "http://schemas.android.com/apk/res/Android" package = "com.example.orientationtest" android: versionCode = "1" Android: versionName = "1.0" & gt; & Lt; Use-SDK Android: minSdkVersion = "8" Android: targetSdkVersion = "15" /> Android: Android: Android: Android: Android: Theme = "@ Style / Aaptim" & gt; & Lt; Activity Android: name = "main activity" Android: label = "@ string / title_activity_man" Android: configChanges = "orientation | keyboard | keyboardhead" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; / Application & gt; & Lt; / Reveal & gt;    

Try with:

  & Lt; Application Android: Icon = "@ Draubable / IC_Luncher" Android: label = "@ string / app_name" & gt; & Lt; Activity Android: name = ". YourMainActivity" android: label = "@ string / title_activity_main" Android: configChanges = "keyboardHidden | Orientation | Screen Size" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; .... & lt; / Application & gt;    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -