This appears to avoid webview state loss when rotating.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4252 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -6,7 +6,9 @@ | |||||||
| 	<uses-sdk android:minSdkVersion="16"/> | 	<uses-sdk android:minSdkVersion="16"/> | ||||||
| 	<uses-permission android:name="android.permission.INTERNET"/> | 	<uses-permission android:name="android.permission.INTERNET"/> | ||||||
| 	<application android:label="Tilde Friends" android:usesCleartextTraffic="true" android:debuggable="true"> | 	<application android:label="Tilde Friends" android:usesCleartextTraffic="true" android:debuggable="true"> | ||||||
| 		<activity android:name=".MainActivity"> | 		<activity | ||||||
|  | 			android:name=".MainActivity" | ||||||
|  | 			android:configChanges="orientation|screenSize"> | ||||||
| 			<intent-filter> | 			<intent-filter> | ||||||
| 				<action android:name="android.intent.action.MAIN"/> | 				<action android:name="android.intent.action.MAIN"/> | ||||||
| 				<category android:name="android.intent.category.LAUNCHER"/> | 				<category android:name="android.intent.category.LAUNCHER"/> | ||||||
|   | |||||||
| @@ -182,6 +182,20 @@ public class MainActivity extends Activity { | |||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	@Override | ||||||
|  | 	protected void onSaveInstanceState(Bundle outState) | ||||||
|  | 	{ | ||||||
|  | 		super.onSaveInstanceState(outState); | ||||||
|  | 		web_view.saveState(outState); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	@Override | ||||||
|  | 	protected void onRestoreInstanceState(Bundle savedInstanceState) | ||||||
|  | 	{ | ||||||
|  | 		super.onRestoreInstanceState(savedInstanceState); | ||||||
|  | 		web_view.restoreState(savedInstanceState); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	@Override | 	@Override | ||||||
| 	public boolean onKeyDown(int keyCode, KeyEvent event) { | 	public boolean onKeyDown(int keyCode, KeyEvent event) { | ||||||
| 		if (keyCode == KeyEvent.KEYCODE_BACK && web_view.canGoBack()) { | 		if (keyCode == KeyEvent.KEYCODE_BACK && web_view.canGoBack()) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user