How to handle the incoming call and screen off situation when AsyncTask is performed?

Zixmfufgbzwqy

New Member
I am trying to update the DB from two online xml file by using XmlPullParser. Sine the data is huge in size, For the reason of safety, I try to insert those new data into the a copy set of table during the downloading process and only copy entire set of data into the true table at the end stage.The question here is that I don't know how to handle the incoming call and screen off situation which will Interrupt the AsyncTask. Can you give me some advice on how to avoid this problem and make it still processing in background? Thankyou in advance.\[code\]public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); }@Overridepublic void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig);}@Overridepublic void onResume(){super.onResume();new Updatetask_song_lyrics().execute();}public class Updatetask_song_lyrics extends AsyncTask<Void, Integer, Void> { ProgressDialog dialog; MyDBHelper dbHelper =new MyDBHelper(DataBaseUpdateService.this); SQLiteDatabase db = dbHelper.getWritableDatabase(); int itemCount; String R_1; String R_2; ArrayList<LinkedHashMap<String, String>> array2; LinkedHashMap map ; @Override protected void onPreExecute() { super.onPreExecute(); dialog =new ProgressDialog(DataBaseUpdateService.this); dialog.setTitle("
 
Back
Top