A. android 怎样获取webview的缓存
请求的url记录是保存在webviewCache.db,而url的内容是保存在webviewCache文件夹下.
为了便于理解,接下来模拟一个案例,定义一个html文件,在里面显示一张图片,用WebView加载出来,然后再试着从缓存里把这张图片读取出来并显示。
第一步:新建一个Android工程命名为WebViewCache.目录结构如下:
第二步:在assets目录下新建一个html文件,命名为index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>WebViewCacheDemo</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<img src="http://img04.taobaocdn.com/imgextra/i4/608825099/T2nGXBXXpaXXXXXXXX_!!608825099.jpg_310x310.jpg"/>
</body>
</html>
第三步:修改main.xml布局文件,一个WebView控件一个Button(点击加载缓存图片用),代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/webView"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="从缓存读取图片"
android:id="@+id/button"/>
</LinearLayout>
第四步:修改主核心程序WebViewCacheDemo.java,这里我只加载了index.html文件,按钮事件暂时没写,代码如下:
package com.ljq.activity;
import java.io.File;
import java.io.FileInputStream;
import android.app.Activity;
import android.app.Dialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
public class WebViewActivity extends Activity {
private WebView webView;
private static final String url="file:///android_asset/index.html";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView=(WebView)findViewById(R.id.webView);
webView.loadUrl(url);
}
}
第五步:在AndroidMainifest.xml文件中加访问网络的权限:
<uses-permission android:name="android.permission.INTERNET" />
B. net webservice数据缓存,该怎么解决
用Session保存是不行的,建议把第一次结果保存在数据库里,或是xml文件里,或是Cookie里,第二次调用的时候把结果从数据库,xml,Cookie里读出来。 另外,为什么不把两个方法整合成一个方法呢?
C. 清除WebSphere中缓存
可能是部署在WebSphere里面的项目还没有去删除吧?,。。
D. C# 怎么把一个xml文件放入缓存中, 又怎么根据取xml节点查询缓存中xml文件所对应的值。
System.Web.Caching.Cache,你去网络一下他的用法,与session的用法差不多
E. was 修改web.xml文件需要重新编译么
您好,提问者:
不需要。
只有在修改了接口后才需要重新编译。
因为服务器在运行的时候会重新加载web.xml文件。
F. web.xml文件的位置到底在哪里啊!!!网上很多人说的位置去找都找不到
工具/材料:以win7系统为例。
1、首先在桌面上,点击“计算机”图标。
G. 如何读写Android的WebView缓存文件
简单步骤解答:
新建一个Android工程命名为WebViewCache。
在assets目录下新建一个html文件,命名为index.html。
修改主核心程序WebViewCacheDemo.java,这里我只加载了index.html文件。
在AndroidMainifest.xml文件中加访问网络的权限。
请求的url记录是保存在webviewCache.db,而url的内容是保存在webviewCache文件夹下。