Restoring state of TextView after screen rotation?

If you want to force your TextView to save its state you must add freezesText attribute: <TextView … android:freezesText=”true” /> From documentation on freezesText : If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is … Read more

Prevent dialog dismissal on screen rotation in Android

The best way to avoid this problem nowadays is by using a DialogFragment. Create a new class which extends DialogFragment. Override onCreateDialog and return your old Dialog or an AlertDialog. Then you can show it with DialogFragment.show(fragmentManager, tag). Here’s an example with a Listener: public class MyDialogFragment extends DialogFragment { public interface YesNoListener { void … Read more