Answer the question
In order to leave comments, you need to log in
Accessing the database from AsyncTask - NullPointerException on GetDatabaseWritable How to fix?
So, I'm on to the community as always with stupid questions. Excuse me for often resorting to this method of solving my problems, but a cursory search in Google did not give certainty, although the description of this problem is quite common.
There is a class:
public class AddTTNActivity extends ListActivity implements OnGesturePerformedListener
dbHelper = new NewPostDbAdapter ( this ) ;
dbHelper. open ( ) ;
public class DoBackgroundUpdate extends AsyncTask < Cursor, Integer , Void >
public NewPostDbAdapter open ( ) throws SQLException {
try {
dbHelper = new NewPostDatabaseHelper ( context ) ;
database = dbHelper. getWritableDatabase ( ) ;
}
catch ( SQLiteException e ) {
close ( ) ;
dbHelper = new NewPostDatabaseHelper ( context ) ;
database = dbHelper.getWritableDatabase ( ) ;
}
return this ;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question