/////////////////////////////////////
DBHelper dbhelper = new DBHelper(this);
try {
dbhelper.createDataBase();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// dbhelper.openDatabase();
if(dbhelper != null)
{
dbhelper.close();
}
// if(Read(this,"cccodeData").equals("")){ Toast.makeText(getBaseContext()," Please Wait Wait!!! ",Toast.LENGTH_LONG).show(); db.addc(); Write(this, "cccodeData", "inserted"); }
/* String dbFile;
String[] dbNames = this.databaseList(); // or ContextWrapper
for (int i = 0; i < dbNames.length; i++) {
dbFile = this.getDatabasePath(dbNames[i]).toString();
Log.i("path:", dbFile);
Toast.makeText(getBaseContext(),dbFile + " " + db.getContactsCount(),Toast.LENGTH_LONG).show();
} */
//////////////////////////////
/////////////////////////////////////////////////////////////////////
/* SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
//OnSharedPreferenceChangeListener mPreferenceListener = new PreferenceChangeListener();
// mPrefs.registerOnSharedPreferenceChangeListener(listener);
OnSharedPreferenceChangeListener listen = new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
// Toast.makeText(getBaseContext(),key,Toast.LENGTH_LONG).show(); // Implementation
}
};
mPrefs.registerOnSharedPreferenceChangeListener(listen); */
I moved the testDB into the projects “assets” folder but I get “FileNotFound” on the getAssets().open(DBName) line.
I am using the Eclipse and the Emulator. If I getAssets().list(“/”) — the file is not shown (but there are entries for “res” and “assets”) but
getAssets().list(“/assets”) is empty.
Any ideas would be greatly appreciated.
tob
Never mind … I found this (finally) elsewhere …
To get an ASSETS folder into your APK:
In /nbproject/project.properties, change
assets.dir=
to
assets.dir=assets
assets.available=true
In /nbproject/build-impl.xml, there is line in the “if=assets.available” target that reads
that needs to be changed to