Try changing:
@Override
public void onSaveInstanceState(Bundle outState) {
((WebView)findViewById(R.id.webview)).saveState(outState);
}
to
browser.saveState
On Fri, Mar 25, 2011 at 11:31 AM, RNeumannVWB <[email protected]>wrote:
> I have a simple app for our field guys that lists out the properties
> they need to visit each day. It launches Google navigation and dials
> the phone for them. Hitting the phone's Home button works fine and
> the app keeps it's current state. Coming back from Google Navigation
> crashes it every time. I know where the error is but can not figure
> out how to fix. Code is below...
>
>
> public class VSIMobile_WebView extends Activity {
> private static String PROVIDER="gps";
> private WebView browser;
> private LocationManager myLocationManager=null;
> private TelephonyManager myTeleManager = null;
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
>
> getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
> WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
> if (savedInstanceState!=null){
> browser=(WebView)findViewById(R.id.webview);
> browser.restoreState(savedInstanceState);
> }else{
> browser=(WebView)findViewById(R.id.webview);
>
>
> myLocationManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
>
>
> myTeleManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
> browser.getSettings().setJavaScriptEnabled(true);
> browser.addJavascriptInterface(new Locater(),
> "locater");
> browser.addJavascriptInterface(new
> JavaScriptInterface(this),
> "Android");
> browser.loadUrl("http://oursite/index.html");
> browser.setWebViewClient(new HelloWebViewClient());
> }
> }
>
> @Override
> public void onSaveInstanceState(Bundle outState) {
> ((WebView)findViewById(R.id.webview)).saveState(outState);
> }
> ..............
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
~ Jeremiah:9:23-24
Android 2D MMORPG: http://solrpg.com/ http://www.youtube.com/user/revoltingx
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en