Why Android Database inserting wrong when onPause -


I have a big data in my project android which I want to put in the database.
I am using AsyncTask to add larger data to the database required to enter the average 5 minutes

But when my phone screen has two bugs closed.

  1- The screen should be on to insert. 2- If the screen turns off one or more times the database will not be good enough.  

question

1- Where am I wrong.
2- Another way to insert larger data: My code

  Expansion of the public class MainActivity activity [Database Bandler DB] extension    

mobile information mobile; Private Set Database Task Set Database Task; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.activity_main); DB = new database scanner (this); Mobile = new mobile notification (); Preferences = PreferenceManager.getDefaultSharedPreferences (this); String State = preferences.getString ("IsSetDataBase", ""); If (! State.equals ("yes")) {setDataBaseTask = new setDataBaseTask (); SetDataBaseTask.execute (); }} Public Zero Before Analysis () (for {int i = 0; i & lt; samsung0.brandStringList.length; i ++) {mobile.Clean (); Mobile.Alert_types = samsung0.Alert_typesStringList [i]; Mobile.brand = samsung0.brandStringList [i]; // and some other db.insertMobileInfo (mobile); } // and override to insert multiple} ontop () {// TODO auto generated method stub super.onStop (); If (loading == true) {stopLoadingAndDownloading (); If (setDataBaseTask! = Faucet & Set Database Tasks .getStatus (!!) = AsyncTask.Status.FINISHED) setDataBaseTask.cancel (true); } Db.close (); } Private class SetDataBaseTask extends to AsyncTask

I have a big data in my project android. Want to include in the database.

Then you can use one and send the broadcast when the entry is complete and the activity can register on the broadcast action (registration cancellation is also required) so that it can appear as something UI Update

I am using AsyncTask to insert larger data to the database. Requires an average of 5 minutes to be inserted.

I do not think this is a good idea, because you have got spoiled in orientation changes! Also, you will leak the original activity for the duration of the engagement. Therefore, transferring insertion to a IntentService will remove the entry from the user.


Comments