mohan
mohan

Reputation: 13165

retain state not working in android

I have two different layouts for activity like layout-land layout-port, with different design. I had given below code but state is maintain but potrait design is coming in landscape mode. Can anybody tell me how to avoid this? Can anybody provide sample code?

I have mention android:configChanges="orientation"

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("bufferedPercentage", video.getBufferPercentage());
    commentWebView.saveState(outState);


    //Toast.makeText(this, "Activity state saved", Toast.LENGTH_LONG).show();
}



if(savedInstanceState!=null)
{
     commentWebView.restoreState(savedInstanceState);
}

Upvotes: 0

Views: 133

Answers (1)

Uday
Uday

Reputation: 6023

remove android:configChanges="orientation" and dont mention any screen orientation also.

This will work

Hope it helps.

Upvotes: 1

Related Questions