Questions tagged [getwritabledatabase]

getWritableDatabase is one of the methods of the Android's SQLiteOpenHelper class which returns a reference to a SQLiteDatabase.

The getWritableDatabase is a method of the SQLiteOpenHelper class, from the Android platform, used to retrieve a reference to a SQLiteDatabase in which the user can insert data. Calling this method will either open an already created database or will trigger the creation of the database if one doesn't exist. Executing this method may take a long time so it's recommended to not call it on the main UI thread.

32 questions
5
votes
5 answers

Intermittent SQLiteException: not an error at dbopen

In my app I'm using DB in many situations, but there is one situation in which I'm getting an exception, not every time and could reproduce it (yet). This is happening only on OS versions 2.3.7 and 2.1-update-1. The code: public void…
Bush
  • 2,433
  • 5
  • 34
  • 57
3
votes
2 answers

Concurrent access to a SQLite database in Android - db already closed

I read a lot of topics on this subjet but no one could answer my question. I access my database from concurrent threads, my SQLiteOpenHelper implements the design pattern of the singleton so I have only one instance for my app. I access my database…
Fr4nz
  • 1,616
  • 6
  • 24
  • 33
2
votes
1 answer

Why does getWritableDatabase crashes on some devices? (sqlite3_open_v2 ... Failed)

My application uses a database and works pretty well on all Android devices. Recently some users pointed that it crashes on HTC Tattoo. I decided to give a try and got one in loan. So, the error come when I call: this.getWritableDatabase(); 09-27…
Waza_Be
  • 39,407
  • 49
  • 186
  • 260
2
votes
1 answer

Android NullPointerException + GetDatabaseLocked

I have got a problem with my programm. I use a database to save the settings of my app. When I save the password in the app it´s all ok, but when I save the name of a "school class" with in principle the same method, but another table it crashes and…
2
votes
5 answers

Getting error while executing getwritabledatabase() in android

I have created one class for database and multiple classes for tables and multiple activity classess everything works fine when I use the database class instance in activity class but at the same time when I use the database class instance in table…
Siva
  • 9,043
  • 12
  • 40
  • 63
2
votes
2 answers

getWritableDatabase() -Nullpoiter Exception (android )

Whenever I fire the database my app crashes. I have been working on this for couple of days. (I am entering only the important code snippets of my databaseAdapter.java file here). I am getting the error in getWritableDatabase():…
2
votes
2 answers

SQLiteOpenHelper.getWritableDatabase() throws NullPointerException ORMLite

This is sets of methods which I use in DatabaseHandler class which extends from OrmLiteSqliteOpenHelper: @Override public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) { try { …
1
vote
1 answer

Android: getWriteableDatabase() error

I have been having this problem for a few days now, and really cant see a problem in the code, so a few extra eyes to have a look is really appreciated. I start the app by simply creating a new database manager object, and opening the managers…
1
vote
0 answers

Android Sqlite failed to open database (not an error)

I am currently programming an Android app where I have to use a SQLite database. At some point it happens that the database (with data stored in it) cannot be opened anymore and the app crashes and I cannot open it up again. When I reinstall the app…
Jonas
  • 13
  • 1
  • 4
1
vote
1 answer

NullPointerException at getWriteableDatabase

I'm trying to create simple database app using SQLite, but it looks like I can't manage to get reference to the created database. I keep getting NullPointerException, which points to getWriteableDatabase command. Database class: public class…
1
vote
1 answer

Java IO Exception Broken Pipe when using SQLitedatabase getWritableDatabase() in android studio

The ADB logs shows this error when I use getWritableDatabase() or getReadableDatabase() functions. ddmlib: Broken pipe java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcher.write0(Native Method) at…
1
vote
1 answer

Android getWritableDatabase throws NullPointerException only sometimes

I have a fragment where a function creates a DatabaseHandler and calls a function within the object: final DatabaseHandler db = new DatabaseHandler(getActivity()); String teamName = db.getTeamName(); with the DatabaseHandler constructor…
Cem
  • 13
  • 2
1
vote
3 answers

Why I'm getting getDatabaseLocked?

I'm trying to access to a sqlite database but I don't know what I'm doing wrong with my code. I don't know where is the problem. Could you take a look? public class DatabaseManager { private SQLiteDatabase db; private DatabaseHelper…
Víctor Martín
  • 3,352
  • 7
  • 48
  • 94
1
vote
1 answer

Android getWritableDatabase() throws a NullPointerException

I am having trouble with my call to getWritableDatabase(). It is returning a NullPointerException. The thing that is strangest is that this error only began occurring after I commented out a couple lines of code in my android manifest. Now the…
1
vote
1 answer

Context exception Android getWritableDatabase

I have a exception thrown when I call the method getWritableDatabase. Reading some similar problems I think is about a problem with the context but I don´t know why. Here is the LOGCAT: 07-22 09:33:57.534: E/AndroidRuntime(406): FATAL EXCEPTION:…
1
2 3