0

我在后台发生了这个错误记录:

10-06 14:05:47.787: W/webcore(554): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
10-06 14:05:47.787: W/webcore(554):     at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
10-06 14:05:47.787: W/webcore(554):     at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
10-06 14:05:47.787: W/webcore(554):     at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
10-06 14:05:47.787: W/webcore(554):     at android.webkit.WebView.sendOurVisibleRect(WebView.java:2917)
10-06 14:05:47.787: W/webcore(554):     at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
10-06 14:05:47.787: W/webcore(554):     at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
10-06 14:05:47.787: W/webcore(554):     at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
10-06 14:05:47.787: W/webcore(554):     at android.os.Handler.handleCallback(Handler.java:605)
10-06 14:05:47.787: W/webcore(554):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-06 14:05:47.787: W/webcore(554):     at android.os.Looper.loop(Looper.java:137)
10-06 14:05:47.787: W/webcore(554):     at android.app.ActivityThread.main(ActivityThread.java:4424)
10-06 14:05:47.787: W/webcore(554):     at java.lang.reflect.Method.invokeNative(Native Method)
10-06 14:05:47.787: W/webcore(554):     at java.lang.reflect.Method.invoke(Method.java:511)
10-06 14:05:47.787: W/webcore(554):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-06 14:05:47.787: W/webcore(554):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-06 14:05:47.787: W/webcore(554):     at dalvik.system.NativeStart.main(Native Method)
10-06 14:05:55.197: E/chromium(554): external/chromium/net/disk_cache/backend_impl.cc:1107: [1006/140555:ERROR:backend_impl.cc(1107)] Critical error found -8

当我第一次打开应该加载 webview 的屏幕时会发生这种情况。有谁知道为什么会这样?

这是我这个非常短的课程的代码:

package com.problemio;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import utils.SendEmail;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebSettings.PluginState;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.RadioGroup.OnCheckedChangeListener;

import com.flurry.android.FlurryAgent;

public class VideosActivity extends BaseActivity
{
    WebView webview = null;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        FlurryAgent.onStartSession(this, "8CA5LTZ5M73EG8R35SXG");

        webview = new WebView(this);
        setContentView(webview);        

        webview.getSettings().setAppCacheEnabled(false);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.setInitialScale(1);
        webview.getSettings().setPluginState(PluginState.ON);

        WebSettings webSettings = webview.getSettings();

        webSettings.setLoadsImagesAutomatically(true);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setBuiltInZoomControls(true);        
        //webSettings.setAllowContentAccess(true);
        //webSettings.setSupportZoom(true);
        webSettings.setUseWideViewPort(true);

        webview.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);              
                return false;
            }
        });        


        webview.setWebChromeClient(new WebChromeClient(){});

        webSettings.setJavaScriptEnabled(true);
        webSettings.setDomStorageEnabled(true);
        webSettings.setAppCacheEnabled(true);
        webSettings.setAppCachePath(getApplicationContext().getFilesDir().getAbsolutePath() + "/cache");
        webSettings.setDatabaseEnabled(true);
        webSettings.setDatabasePath(getApplicationContext().getFilesDir().getAbsolutePath() + "/databases");

        webview.loadUrl("http://www.youtube.com/user/Okudjavavich");   


    }       

    @Override
    public void onPause()
    {
       super.onPause();
       // your code
       try
       {
           webview.clearCache(true); 
           webview.getSettings().setAppCacheEnabled(false);
           webview.clearView();
           webview.stopLoading();
           webview.destroy();
           this.finish();
       }
       catch ( Exception e )
       {

       }
    }



    @Override
    public void onDestroy()
    {
       super.onDestroy();
       // your code

       try
       {
           webview.getSettings().setBuiltInZoomControls(true);

       }
       catch ( Exception e )
       {

       }    
    }

    @Override
    public void onStop()
    {
       super.onStop();
       // your code

       FlurryAgent.onEndSession(this);


       //webview.goBack();
       try
       {
           webview.clearView();
           webview.getSettings().setAppCacheEnabled(false);
           webview.stopLoading();
           webview.destroy();
       }
       catch ( Exception e )
       {
           //sendEmail ("Podcast error" , e.getMessage() + "" );
       }

       this.finish();
    }   



    @Override
    protected void onResume() 
    {
        super.onResume();

        try
        {
            webview.onResume();
        }
        catch ( Exception  e )
        {

        }
    }

    @Override
    protected void onStart() 
    {
        super.onStart(); 
    }

    @Override
    protected void onRestart() 
    {
        super.onRestart();
    }    

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) 
    {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) 
        {
            webview.goBack();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }   

    //@Override 
    public void onPageFinished(WebView view, String url) 
    { 
        view.clearCache(true); 
    }

    public void onBackPressed ( )
    {
        webview.clearView();
    }    
}
4

0 回答 0