File file = CacheManager.getCacheFileBaseDir();
if(file.exists()){
       file.delete();
}
webview.clearCache(true);
webview.clearHistory();
webview.clearFormData();
context.deleteDatabase("webview.db");
context.deleteDatabase("webviewCache.db");
全用上了都不起作用,Webview每次还会加载上次的页面
请高手帮忙解决一下这个问题

解决方案 »

  1.   

    直接删除/data/data/pkg name/xxx/中的目录就行了,xxx是缓存的数据库临时文件等
      

  2.   

    这样的话程序会报错:不能打开数据库的错(webview.db和webviewCache.db)
      

  3.   

    网上有的:    第一步:新建一个Android工程命名为WebViewCacheDemo.目录结构如下:
      第二步:在assets目录下新建一个html文件,命名为index.html。
      第三步:修改main.xml布局文件一个WebView控件一个Button(点击加载缓存图片用)。
        
      <?xmlversion="1.0"encoding="utf-8"?>
      <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      >
      <WebView
      android:id="@+id/webview"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      />
      <Button
      android:id="@+id/button"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="从缓存里读取图片"
      />
      </LinearLayout>  第四步:修改主核心程序EOE.android.java,这里我只加载了index.html文件,按钮事件暂时没写,代码如下:  
      packageEOE.android;
      importandroid.app.Activity;
      importandroid.os.Bundle;
      importandroid.view.View;
      importandroid.view.View.OnClickListener;
      importandroid.webkit.WebView;
      importandroid.widget.Button;
      publicclassWebViewCacheDemoextendsActivity{
      privateWebViewmWebView;
      //privateButtonmButton;
      privatestaticfinalStringurl="file:///android_asset/index.html";
      @Override
      publicvoidonCreate(BundlesavedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      mWebView=(WebView)findViewById(R.id.webview);
      mWebView.loadUrl(url);
      //mButton=(Button)findViewById(R.id.button);
      //mButton.setOnClickListener(listener);
      }
      }  第五步:在AndroidMainifest.xml文件中加访问网络的权限:
    < uses-permission android:name="android.permission.INTERNET" />
      

  4.   

    m_webview.loadDataWithBaseURL(null, result,"text/html", "utf-8",null);
    可以解决问题,不怕缓存用完,不用清空缓存。
    clearcache
    clearhistory
    都不管用
      

  5.   

    可以用webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);可以解决缓存问题,刚测试可用
      

  6.   

    我也是这样的问题,页面是都放到设备本地assets目录的。每次测试时即使卸载了apk,下次debug发现web加载的页面还他妈是上次的。每次都要两次才行。
      

  7.   

    WebView wv = appView;
            wv.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
            wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
            wv.clearCache(true);
            wv.destroyDrawingCache();
      

  8.   

     对mWebView设置如下:
    mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
     再文章展示之后,切换下一篇之前,做如下处理:
    mWebView.loadDataWithBaseURL(null, "","text/html", "utf-8",null);
    测试已通过