assets - Retrieve data from sqlite database and display in assest folder's HTML page in android -


i want make dynamic webpage can display sqlite database's element in tabular format. how can create dynamic webpage in android? make static html page , put in assest folder. works want dynamic webpage. please help:

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 activity 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();         }     } }  

this page works ... make dynamic through code.

gaurav gupta

use java.text.messageformat:

  1. put "{0}" markers in html file.
  2. read html file string
  3. create arguments array database record
  4. call messageformat.format(htmlstring, dbargs)
  5. load resulting string webview.

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -