How can I retain text-selected find status when screen rotation in android
In my Application, I use Webview to show the website, then I long press the website content, to create the system default Actionmode,the "select" ,"copy" ,"share" ,"find" menu show, then I click the "find" item the selected word can be saw in find text editor. But when I rotate the screen, all the menu and find text editor is destroyed, return to the initial status when I open the website at beginning. My question is after screen rotation ,what can I do to retain the find status?
PS: I know when the screen rotating, the Activity is destroyed and recreated, so the status before rotating lost. But I do not know what object should I save in onSaveIntanceState() method. Also I do not want to use the android:configChanges in AndroidManifest.xml file.
I did like below
protected void onSaveInstanceState(Bundle outState) {
webView.saveState(outState);
}
Then recover this in your onCreate after the webview has been re-inflated of course:
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.blah);
if (savedInstanceState != null)
((WebView)findViewById(R.id.webview)).restoreState(savedInstanceState);
}
but it does not work, the text-selected-find status is still lost.
I think if I can get the system default ActionMode instance,so I can save it, but I don't find any way to get that instance.