Issue
In Android Studio, I've tried to implement the methods interface of AsyncTask, but it only shows method doInBackgound(). I've tried to place the cursor on the AsyncTask and then press Alt+Enter, but it only offers method doInBackgound().
import android.os.AsyncTask;
import java.net.URL;
public class MyTask extends AsyncTask<URL, Integer, Long> {
@Override
protected Long doInBackground(URL... urls) {
return null;
}
}
Solution
The reason you're seeing only the AsyncTask::doInBackground(URL...) is because the method is not implemented in the abstract class AsyncTask.
However, the others have default implementations and so you can only override them. If you need IntelliJ or Android Studio to suggest the others, you need to do CTRL + O. This will suggest other methods you can override from the parent classes.
Answered By - Patrick W

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.