I have done some background activities inside an asynctask class on my Application. And the result from this is saving into SQLite DB. But db insertion is not happening and never showing any error on console. Please see below code and let me know if you see any issues.
private class AsyncTaskRunner extends AsyncTask<String, String, String>{
String username;
ProgressDialog progressDialog;
@Override
protected void onPreExecute() {
progressDialog = new ProgressDialog(TestScreen.this,R.style.MyTheme);
progressDialog.setCancelable(false);
progressDialog.setProgressStyle(android.R.style.Widget_ProgressBar_Large);
progressDialog.show();
super.onPreExecute();
}
@Override
protected String doInBackground(String... strings) {
ArrayList<String> array_time = dbManager.fetchTimeStamp();
username = strings[0];
PyObject pyObject1 = null;
if (! Python.isStarted()) {
Log.d("Py..","Py..");
Python.start(new AndroidPlatform(getApplicationContext()));
Python py = Python.getInstance();
PyObject pyObject =py.getModule("app");
pyObject1 = pyObject.callAttr("score",mStartTestTime,endTestTime);
count = pyObject1.asList().get(0).toInt();
p_total_time = pyObject1.asList().get(1).toDouble();
p_score= pyObject1.asList().get(6).toDouble();
}
return username;
}
@Override
protected void onPostExecute(String s) {
dbManager.insertStatistics(s,helper.TABLE_STATISTICS,,p_count,
p_total_time,Category,p_score);
}
}