I am using an Asynctask to do some processing, after which a UI List is updated with the remaining/ additional items (addition or deletion case).
The functionality works properly in the debug apk that I work on in Android Studio. However, it is not working in the release APK file.
When I analysed further, I am seeing that the functionality is showing correct result when I lock and unlock the screen, or if I close and reopen the app. It fails only in producing an instantaneous update.
This is why I felt there is something wrong in the asynctask.
public class RefreshDisplayAsyncTask extends AsyncTask<Void, Void, Void> {
private Activity curActivity = null;
private boolean shouldProceed = false;
public RefreshDisplayAsyncTask(Activity activity)
{
curActivity = activity;
}
protected Void doInBackground(Void... params) {
//Log.d("UIBug","RefreshTask entered");
((MainActivity)curActivity).setUpList();
shouldProceed = false;
curActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
((MainActivity)curActivity).listView.setAdapter(new listArrayAdapter(curActivity,((MainActivity)curActivity).list1,((MainActivity)curActivity).list2));
shouldProceed = true;
}
});
while(!shouldProceed){}
//Log.d("UIBug","RefreshTask completed");
return null;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Void result) {
// if(progressDialog!=null)
// {
// progressDialog.dismiss();
// }
}
}
Why is the signed apk producing incorrect behaviour while the unsigned apk is behaving properly? How to rectify this?