In my old project, I used AsyncTask, but its deprecated so what method i used instead of this? If we used thread, in AsyncTask having onbackground, onPreExecute and onPostExecute Override methods where this sections called in thread. Is there any alternative method. Can you please give me the solution?
Java code:
public class getDetailsfromWeb extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... params) {
if (paymentSync == null)
paymentSync = new ReceivePaymentSync(getActivity());
allCreditCardModel = new AllCreditCardModel();
allCreditCardModel = paymentSync.getGetCreditCardById(CrediCardId);
handler.post(allCreditRunnable);
return null;
}
/**
* @param string
*/
public void execute(String string) {
// TODO Auto-generated method stub
}
protected void onPreExecute() {
showProgress();
}
@Override
protected void onPostExecute(String result) {
progress.dismiss();
}
}