Closed Thread Icon

Topic awaiting preservation: ANDROID SQLLite problems Pages that link to <a href="https://ozoneasylum.com/backlink?for=32064" title="Pages that link to Topic awaiting preservation: ANDROID SQLLite problems" rel="nofollow" >Topic awaiting preservation: ANDROID SQLLite problems\

 
Author Thread
Blacknight
Paranoid (IV) Inmate

From: INFRONT OF MY PC
Insane since: Dec 2001

posted posted 12-06-2010 21:35

Hi
I have started to learn android developement.
So i started creating a little app that uses a sqlLite DB
I had all my DB accesses scattered around my app so i decided to create aDBHandler class to have it all in one place.

Now i get following error:
12-06 21:30:35.250: ERROR/AndroidRuntime(183): java.lang.RuntimeException: Unable to start activity ComponentInfo{my.helloWorld/my.helloWorld.selectGroups}: android.database.sqlite.SQLiteException: unable to open database file


old CodeWorked fine)

code:
private void some_function() {
		myDB = this.openOrCreateDatabase(MY_DB_NAME, MODE_PRIVATE, null);



new CodeThrows above error)

code:
public class DBHandler{//threadsafe singleton
.
.
private static DBHandler instance;
.
.
public static synchronized DBHandler getInstance() {
		if (DBHandler.instance == null) {
			DBHandler.instance = new DBHandler();
			instance.myDB = android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(MY_DB_NAME, null);
		}
		return DBHandler.instance;
	}



has anyone got an idea why i cannot access my db from this class? am i missing something here?
thanks for the help

(Edited by Blacknight on 12-06-2010 21:37)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 01-07-2011 15:03

I'd guess it was because you were not passing MODE_PRIVAT in the second variant.

But then, you're most likely very much done with this 'already'

So... I just got an Android of my own. and am therefore highjacking this thread.
What apps do y'all use?

Blacknight
Paranoid (IV) Inmate

From: INFRONT OF MY PC
Insane since: Dec 2001

posted posted 01-08-2011 10:37

actually I had not yet fixed it, had no time to do some coding. will try and fix it tomorrow.

I use my android phone mainly for email and google maps, so I hardly use any other apps.

kimson
Paranoid (IV) Inmate

From: Mercury City
Insane since: Jan 2005

posted posted 01-08-2011 14:36

I personally count on you to build some great games The choice out there is appalling...

@Tyberius Prime: I personally enjoy the following apps:

- Layar
- Evernote
- Twidroyd
- WhatsApp
- Bonzai Blast (the best game I have found so far)

I'm still to find the perfect notes and calendar app, and also I need to get my phone fixed as it keeps rebooting randomly, sometimes in a loop, and in spite of a complete factory reset

______________________________________

The Fat Controller is gonna get you in the end.

kuckus
Paranoid (IV) Mad Librarian

From: ber/ger
Insane since: Dec 2001

posted posted 01-08-2011 16:29

I like Swype a lot as a replacement for the default touch keyboard - will be really hard to switch to a phone that doesn't have it. Though it might well make its way to iPhone 7/8
For notes I use "Notes", but I'm also looking for a calendar app other than the HTC one. Some others I've gotten used to are K-9 Mail, Handcent sms, SoundHound, Öffi, and Klindle whenever trains run late...

« BackwardsOnwards »

Show Forum Drop Down Menu