Beiträge von S26

    I have Android 2.1, SDK 7. But I built a project with the same code for Android 2.2 and 2.3. Nothing changed, so this can't cause the problem.


    But I'm note sure if the running http-threads cause my problem, that the message "web page not available" is displayd after opening of several webpages.
    Maybee this has an other reason?

    In the onPause-method of the activity i call the onPause of the webview as shown below. There occours NO error, but the treads (http0, http1, http2, http3) are still running (not paused). Maybee you can give me a working code-sample what to do in the onPause-method of the activity?


    protected void onPause(){
    super.onPause();
    webview.clearCache(true);
    webview.pauseTimers();
    if(isFinishing()){
    webview.loadUrl("about:blank");
    }


    try {
    Method method = WebView.class.getMethod("onPause");
    method.invoke(webview);
    } catch (IllegalArgumentException e) {
    e.printStackTrace();
    } catch (SecurityException e) {
    e.printStackTrace();
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (InvocationTargetException e) {
    e.printStackTrace();
    } catch (NoSuchMethodException e) {
    e.printStackTrace();
    }


    CookieSyncManager.getInstance().stopSync();
    }

    Hello,


    I have the following problem with a WebView Control. I have the following code:


    public class MyWebView extends Activity {
    private WebView webview;
    ...


    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mywebview);
    ...
    webview = new WebView(getApplicationContext());
    webview.setWebChromeClient(new WebChromeClient() { ... });
    webview.setWebViewClient(new WebViewClient() { ... });
    ...
    webview.loadUrl("http://www.google.de");
    }


    The Webpage is opened, but if close the Activity on Back-Button pressed and go back to my main-menue, the WebView is not closed and the http-threads keep running.
    If I open about 10 several pages one after another, the Webpages are not nonger loadet, but "Webpage not available" is displayd in the WebView.


    I tried to close the thread by adding the code:
    webview.destroy();
    webview = null;
    and
    myLinearLayout = null;
    and
    Method op = Class.forName("android.webkit.WebView").getMethod("onPause",(Class[]) null);
    op.invoke(webview, (Object[]) null);


    But there is no change - the http-threads are still running.
    What is wrong? How to close the WebView in the right way?


    Thanx a lot for any suggestions!