I have an sqlite database in which I have a content I want to load in webview ,,
as I want to select from database and show in web view,, Is there any way to do so ?
public class TataworatYawmeeh extends Activity {
WebView webView;
String javascrips;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tataworat);
webView = (WebView) findViewById(R.id.tatworatWebView);
webView.setBackgroundColor(0x00000000);
try {
DataBaseHelper myDbHelper = new DataBaseHelper(this);
myDbHelper = new DataBaseHelper(this);
try {
myDbHelper.createDataBase();
String selectQuery = "SELECT * FROM 'nnn'";
SQLiteDatabase db = myDbHelper.getReadableDatabase();
db.execSQL(selectQuery);
} catch (IOException ioe) {
throw new Error("Unable to create database");
}
try {
myDbHelper.openDataBase();
} catch (SQLException sqle) {
throw sqle;
}
}
}
}
You have to use a Java Class as interface:
In your activity you can declare the anonymous class DataLoader, with a get method where you retrieve data and return it using JSON like this:
And finally, you can use this data in your html, using javascript: