2011-02-18 50 views

回答

1

使用的WebView的HTML文档使用的WebView的HTML文件,你可以使用常规投影(Select query)并使用Cursor获取HTML。

0

在Web视图中显示SQLite数据库输出以使用StringBuilder将所有需要的输出封装在HTML标记中。

实施例在http://www.androiddom.com/2011/06/android-and-sqlite.html从完整的教程采取:

StringBuilder builder = new StringBuilder(); 
builder.append("<html><body><h1>Headline</h1><table>"); 

c.moveToLast(); 
for(int i=c.getCount()-1; i>=0; i--) { 

// Get the data 
builder.append("<tr><td>"); 
builder.append(c.getString(0)); 
builder.append("</td><td>"); 
builder.append(c.getString(1)); 
builder.append("</td></tr>"); 

// Move the cursor 
c.moveToPrevious(); 
} 

builder.append("</table></html>"); 
webview.loadData(builder.toString(), "text/html", "UTF-8"); 
相关问题