user2227904
user2227904

Reputation: 679

Android: How to retain my intent open on screen change

From my main activity I open an intent with textboxes to edit data, but on screen rotation the opened intent closes and leaves only the starting activity. How should I handle it so that my secondary intent is not closed on screen rotation.

Upvotes: 0

Views: 110

Answers (1)

Vinothkumar Arputharaj
Vinothkumar Arputharaj

Reputation: 4569

Add android:configChanges="orientation|keyboardHidden|screenSize" in your activity declaration in AndroidManifest.xml file

or handle you data in

 @Override
    protected void onSaveInstanceState(Bundle outState) {
        // store the data in bundle
        super.onSaveInstanceState(outState);
    }

and restore the data in

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    // restore the data from bundle and settext to edittext
    super.onRestoreInstanceState(savedInstanceState);
}

Upvotes: 1

Related Questions