public class SecondActivity2 extends AppCompatActivity {
public static String main_html = "";
public static int second_action = 0;
WebView webView2;
public static taskResearch ndc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSupportActionBar().hide();
setContentView(R.layout.activity_main);
webView2 = (WebView) findViewById(R.id.webView);
String userid = "12345";
try {
ndc = new TaskResearch(userid, "1", "keyword", 5, 4, "orderid", 6, "title", "text");
ndc.execute("");
} catch (Exception e) {
e.printStackTrace();
}
Log.v("htmlg", "taskResearch finished");
}
class TaskResearch extends AsyncTask <String, String, String> {
String deviceId, s_id, keyword, city, s_title, s_text;
int count1, size1, online;
public TaskResearch(String deviceId, String s_id, String keyword, int count1, int size1, String city, int online, String s_title, String s_text){
this.deviceId = deviceId;
this.s_id = s_id;
this.keyword = keyword;
this.city = city;
this.s_title = s_title;
this.s_text = s_text;
this.count1 = count1;
this.size1 = size1;
this.online = online;
}
protected String doInBackground(String... strings) {
String sonuc = "";
runOnUiThread(new Runnable() {
public void run() {
}
});
return "a";
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
}
}
class html_reader {
@SuppressWarnings("unused")
@JavascriptInterface
public void processHTML(final String html) {
// Log.d("HTMLG", "html: " + html);
// Log.d("HTMLG", "html: " + html);
// html_reader jssil = new html_reader(deviceId, sId, swAfter, swcity);
// webView2.addJavascriptInterface(jssil, "HTMLOUT");
main_html = html;
}
@SuppressWarnings("unused")
@JavascriptInterface
public void ok() {
// Log.d("HTMLG", "html: " + html);
// Log.d("HTMLG", "html: " + html);
// html_reader jssil = new html_reader(deviceId, sId, swAfter, swcity);
// webView2.addJavascriptInterface(jssil, "HTMLOUT");
second_action = 1;
}
}
Hello Friends.
My codes are above. I want to run this command.
ndc = new taskResearch(userid, "1", "keyword", 5, 4, "orderid", 6, "title", "text");
When this command finished. I want this command to run.
Log.v("htmlg", "taskResearch finished");
But 2 of them start together and second one finishes firstly. I want that first command should start and finish then second command should start. How can i do that ?
What is my mistake ?