Issue
I am trying to use AsyncTask but both my doInBackground and onPostExecute methods give me the same error saying Method does not override method from its superclass
. My code is:
public class SigninActivity extends AsyncTask{
private TextView status, result;
private Context context;
private int flag = 0;
public SigninActivity(Context context, TextView status, TextView result, int flag) {
this.context = context;
this.statusField = status;
this.roleField = result;
this.flag = flag;
}
protected void onPreExecute() {
}
@Override
protected String doInBackground(String... arg0) {
//Code
}
@Override
protected void onPostExecute(String result) {
//Code
}
Solution
You should create AsyncTask with three parameters < X,Y,Z >. For more details in here
private class MyAsyncTask extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
// your code
}
@Override
protected void onPostExecute(String result) {
//your code
}
@Override
protected void onPreExecute() {
//your code
}
@Override
protected void onProgressUpdate(String... text) {
// your code
}
}
Answered By - Beyazid
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.