sqlite データベースの要素を表形式で表示できる動的な Web ページを作成したいと考えています。Androidで動的Webページを作成するにはどうすればよいですか? 静的な HTML ページを作成し、assest フォルダーに配置します。それは機能しますが、今は動的な Web ページが必要です。助けてください:
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();
}
}
}
このページは機能します...コードを使用して動的にするのに役立ちます。
ガウラフ・グプタ