I’m learning from Google’s Android developing tutorial and i came across a problem.
In Android’s Connecting to the Network Guide it says to create a class that extends AsyncTask.
So when I wrote the class it automatically implements the method as follows:
private Object doInBackground(Object... args) {..} //it's fine
but when i try writing just as it says in the tutorial:
private String doInBackground(String... args) {..} //it gives an error
and the error says:
The method doInBackground(String...) of type MainActivity.DownloadWebpageText must override a superclass method.
So how do I change Object to String without getting an error there?
When you extend AsyncTask you must define the inputs to the background, progress, and post execute methods. Like this
Which would define a class that extends AsyncTask and takes as input String and returns a Boolean to the onPostExecute method.