English 中文(简体)
咨询轮值费用是我的网络访问班。
原标题:The advice rotation charges again my webviews class

当我轮流使用我的装置时,这再次指控他。 例如,如果我在改变方向指控时有洞察力,我会再次 go。

我尝试:

@Override
public void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  setContentView(R.layout.principal);
}

以及居住国和居住国。 但我的问题依然存在。 如果有人能够帮助我举一个例子或说明如何做到这一点,我将不胜感激。

感谢!


我先解决了这一问题,我需要做的是,如果(savedInstanceState= 无):

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.principal);

    webview.setWebViewClient(new WebViewClient());

    if (savedInstanceState == null)
    {
        webview.loadUrl("http://www.apple.es");
    }
}

  @Override   
    protected void onSaveInstanceState(Bundle outState)
    {  
      super.onSaveInstanceState(outState);  
      // Save the state of the WebView    
      webview.saveState(outState);
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState)  
    {  
      super.onRestoreInstanceState(savedInstanceState);
      // Restore the state of the WebView
      webview.restoreState(savedInstanceState);
    }

我希望我的问题和我的解决办法能够帮助一些人!

最佳回答

Christian你必须看到ts doc on android developer web website,并了解romain guy如何储存他最后装满的图像,并在配置筛选变化时叫他们! 解决办法是使用

  1. onRetainNonConfigurationInstance()
  2. getLastNonConfigurationInstance()

参看tutorial 总是摆脱对 and和roid的筛选变化的偏好

希望这将帮助你

问题回答

Add configChanges in your AndroidManifest file. For example:

<activity android:name="YourActivityName"
          android:configChanges="orientation">
</activity>

页: 1

@Override
public void onConfigurationChanged(Configuration newConfig) {
    yourWebView.loadUrl(yourUrl);
}




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签