我想做一个动态网页,可以用表格格式显示我的sqlite数据库的元素。如何在android中创建动态网页?我制作了一个静态的HTML页面并放在assest文件夹中。它的工作,但现在我想要一个动态网页。请帮助:
package com.Htmlview;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class Htmlview extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
WebView webview = new WebView(this);
setContentView(webview);
try {
InputStream fin = getAssets().open("index3.html");
byte[] buffer = new byte[fin.available()];
fin.read(buffer);
fin.close();
webview.loadData(new String(buffer), "text/html", "UTF-8");
} catch (IOException e) {
e.printStackTrace();
}
}
} 这个页面可以工作...通过代码帮助使其动态。
古普塔
发布于 2011-02-19 00:36:33
使用java.text.MessageFormat:
发布于 2011-02-18 21:18:54
您不能在运行时修改资产文件夹,因为它是在构建时编译的。所以,你有两个变种:
https://stackoverflow.com/questions/5041696
复制相似问题