55.5 Subclassing AsyncTask
In order to create a new thread, the code to be executed in that thread needs to be performed within an AsyncTask instance. The first step is to subclass AsyncTask in the MainActivity.java file as follows:
.
.
import android.os.AsyncTask;
.
.
public class MainActivity extends AppCompatActivity {
.
.
private class MyTask extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
}
@Override
protected String doInBackground(String... params) {
}
@Override
...