문제

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.

도움이 되었습니까?

해결책

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);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top