Android SQLite closing database between 2 activities -


I know that there are platform threads similar to this one, but I've read them and try ways to solve the problem But I did not find this to happen:

The details that were called on (database) / data / data were not ... < P> The application did not close the database or the cursor which was opened ...

My error is not straightforward, it happens after a while May include go between the two movements back and forth.

I use two activities which both require connections from the database. My idea was for the first activity to stop the database before other activity began. Here is my code:

  @Orride Creates a public void form (bundle saved instance) {super.onCreate ( SavedInstanceState); SetContentView (R.layout.main); Movies = new movie data (this); Cursor = when matching (); ShowTitles (cursor); } @ Override Public Wide On Pause () {movies.close (); Super.onPause (); } @ Override Public Wide On Résumé () {Movies = New Movies Data (this); Super.onResume (); }   

This is my first activity, the second one is very similar and has been started by pressing a button. MoviesData class is empty only empty Empty SQLiteOpenHelper class.

  Public class MoviesData Extended SQLiteOpenHelper {Private Static Last String DATABASE_NAME = "movies.db"; Personal Static FINAL END DATABASE_VERSION = 1; Public Movie Data (Reference Reference) {Super (Reference, DatabaseNNAn, Blank, DatabaseBySSSS); }}   

I now know when the error is displayed. If I leave the application and then open it again and am trying to do something that is causing the error. I tried to close the database in "onDestroy ()", but there is no help from this ...

  // override public pause at zero () {super.onPause (); Movies.close (); Cursor.close (); } // No need to write this code @ Override Public Records on Resum () {Movies = New Movies Data (this); Super.onResume (); }    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -