mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
Fixing the 1.5 Storage. Got inheritance wrong in this case
This commit is contained in:
parent
5b5c2590f9
commit
d81f53465f
@ -94,7 +94,6 @@ public class DroidGap extends Activity {
|
||||
else
|
||||
{
|
||||
appView.setWebChromeClient(new GapClient(this));
|
||||
cupcakeStorage = new Storage(appView);
|
||||
}
|
||||
|
||||
appView.setInitialScale(100);
|
||||
@ -113,7 +112,9 @@ public class DroidGap extends Activity {
|
||||
|
||||
/* Bind the appView object to the gap class methods */
|
||||
bindBrowser(appView);
|
||||
|
||||
if(cupcakeStorage != null)
|
||||
cupcakeStorage.setStorage(appPackage);
|
||||
|
||||
root.addView(appView);
|
||||
setContentView(root);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.phonegap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.*;
|
||||
import android.util.Log;
|
||||
@ -12,19 +13,25 @@ public class Storage {
|
||||
String path;
|
||||
String txid = "";
|
||||
WebView appView;
|
||||
Context mCtx;
|
||||
|
||||
Storage(WebView view)
|
||||
{
|
||||
Package pack = this.getClass().getPackage();
|
||||
String appPackage = pack.getName();
|
||||
path = "/data/data/" + appPackage + "/databases/";
|
||||
{
|
||||
appView = view;
|
||||
}
|
||||
|
||||
public void setStorage(String appPackage)
|
||||
{
|
||||
path = "/data/data/" + appPackage + "/databases/";
|
||||
}
|
||||
|
||||
public void openDatabase(String db, String version, String display_name, long size)
|
||||
{
|
||||
path += db + ".db";
|
||||
myDb = SQLiteDatabase.openOrCreateDatabase(path, null);
|
||||
if (path != null)
|
||||
{
|
||||
path += db + ".db";
|
||||
myDb = SQLiteDatabase.openOrCreateDatabase(path, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void executeSql(String query, String[] params, String tx_id)
|
||||
|
Loading…
Reference in New Issue
Block a user