AsyncUtil vs AsyncTask

19 views
Skip to first unread message

Carlos Pedroza

unread,
Oct 6, 2017, 2:53:24 PM10/6/17
to App Inventor Open Source Development
Hello! Is there any advantages of using AsyncUtil instead of AsyncTask?
I'm making a SQLite Extension and I managed to use the AsyncTask to execute queries in background. But I don't know if I should try with AsyncUtil instead.

Here it is my class to ExecuteSQL asynchronously, this works but I want to know if this is the best practice or should I use AsyncUtil.
private class ExecuteSQL extends AsyncTask<Void,Void,Void> {
               
@Override
               
protected Void doInBackground(Void... voids){
                       
DbHelper helper = new DbHelper(context);
                       
SQLiteDatabase db = helper.getWritableDatabase();
                        db
.execSQL(SingleSQLStatement);
                       
return null;
               
}
               
               
@Override
               
protected void onPostExecute(Void aVoid){
                       
if (!suppressToast) { Toast.makeText(context,"Done",Toast.LENGTH_SHORT).show(); }
                       
AfterExecution(true);                  
               
}
       
}



Moliata

unread,
Oct 6, 2017, 3:18:19 PM10/6/17
to App Inventor Open Source Development
Actually, AsyncUtil was made to help you easier use AsyncTask. So for simplicity, use AsyncUtil, for more freedom (and options that you can change) choose AsyncTask
Reply all
Reply to author
Forward
0 new messages