In PhoneGap how do I create/open a database in Android?
I am using this code to create a database:
function onDeviceReady() {
alert("okey");
var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
}
then, in console it prints this error message:
E/Web Console(13516): TypeError: Result of expression 'db' [null] is not an object. at file:///android_asset/www/index.html:24
How can I remove this problem?
I think your problem is with scope of db variable. Try this
var db;
function onDeviceReady() {
alert("okey");
db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.