Your Weight Issues are NOT your Fault.
Up until now, there was never 1 simple solution to weight-loss.
On Todays Doc Oz.....
DrOz is shares how you can drop pounds, improve your health, and be a positive influence for others.
You can lose 1-lb per day (w/out starving or exercise)
View Episode Clip -> http://www.rotateyup.com/fat/reboot/weightloss/oz.video
Youll be burning fat 24/7.... Starting Today!
[OzBlog-Daily]
to modify message settings - write to Current Update Alerts at- one six four four Doral Dr
Brookings, SD 57006 or visit http://www.rotateyup.com/ey4e3/of993.endjui
Better add also android:screenOrientation="portrait" to activity properties in manifest and call super.onConfigurationChanged(newConfig) too - otherwise other (or future) configChanges won't work. tomash Dec 29 '09 at 19:03
11
I dont think the second approach works. I tried it; one Activity with a EditText. I wrote some text there, change orientation and the text was gone/reset. Ted Jan 9 '10 at 3:20
When I try it, I get an Exception saying "SuperNotCalledException". It requires that the overridden onConfigurationChanged call super.onConfigurationChanged, and that will make it do the onCreate... =( Ted Jan 9 '10 at 3:26
111
Here's hoping we see an onRotate() method in the future. Having to even worry about things like this isfranklyfrustrating. Kelly Sutton Jul 28 '10 at 15:12
Just to make things crystal clear, the android:configChanges attribute needs to go inside the <activity> tag like this: <activity android:configChanges = "orientation" > </activity> justinl Aug 4 '10 at 1:09
2
Don't forget the keyboardHidden in android:configChanges. I did, and it caused the activity to be destroyed and recreated anyway. beetstra Feb 10 '11 at 0:23
Agree with @Ted, the text in my EditText disappears when the screen is rotated. (tested on emulator 2.2) Emerald214 Sep 10 '11 at 18:45
49
Note that the Android Dev Guide cautions against using this: Note: Using (android:configChanges) should be avoided and used only as a last-resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change. In lieu, to persist data across rotation events, they seem to prefer using the onSaveInstanceState Bundle; or as @Jon-O mentions, onRetainNonConfigurationInstance. Jeffro Dec 1 '11 at 19:08
12
That is a bad solution, because it only reacts to currently known configuration changes. With newer Android versions, other configuration changes may occur which this code will not catch (because it must list all config changes in the manifest). The solution of saving the state with onRetainNonConfigurationChanges is more fault tolerant and straight forward. Bananeweizen Dec 29 '11 at 8:32
11
I think you should add this update on 3.2 to your answer, it's quite important (just faced that problem) and it might get overlooked. bigstones Mar 21 '12 at 21:54
@RetoMeier as far as I understood, I have to define my UI components (like ListView) in the Main Activity class not in the Singleton class which extends the Application class. So I have to set the Adapter in Main Activity class too. What should go to the Singleton class? AnujAroshA May 18 '12 at 9:00
@RetoMeier: The only issue I found with the onConfigurationChanged() method is, aside from Jeffro's comment above, is that it does not detect if the user manually click the "Auto Rotation" button found in the notification bar. Of course, one can try to do something like Settings.System.getInt(context.getContentResolver(), "accelerometer_rotation") to determine if the setting has been changed. But this is an "ugly" solution. I haven't found a way yet to solve this particular issue. ChuongPham Aug 17 '12 at 15:16
2nd worked for me when just adding the declaration the to manifest and not adding the java code. Gaeburider Nov 21 '13 at 17:48
@Carl i had two layout portraint and landscap i had used onConfig method it's work fine but my activity will take data from web service so i am displaying progress bar so issue it that when it's display progress bar and orientation change it's cras.
No comments:
Post a Comment