I want to run two connections using Android Native :
public class MyPublicClass extends AppCompatActivity {
here is the first class
private class GetNextQuestionIndex extends AsyncTask<String, Void, Void> {
//some code
protected Void doInBackground(String... params) {
URL url = new URL("url1");
//some code to initialize connection and get the output
MyPublicClass.this.runOnUiThread(new Runnable() {
@Override
public void run() {
mytxtview.setText(output1)
System.out.println("1");
progress.dismiss();
}
});
Here is the second class
private class GetLibelleOfQuestion extends AsyncTask<String, Void, Void> {
//some code
protected Void doInBackground(String... params) {
URL url = new URL("url2");
//some code to initialize another connection and get another output
MyPublicClass.this.runOnUiThread(new Runnable() {
@Override
public void run() {
mytxtview.setText(output2)
System.out.println("2");
progress.dismiss();
}
});
}//the end of the public class
but when i run my code its give me
2 1
how can I get
1 2
?
which means execute the run of GetNextQuestionIndex
before the run of GetLibelleOfQuestion