从我的MainActivity执行几个http get请求调用(HttpURLConnection execute(的最佳方法是什么?
我应该这样做吗:
HttpGetRequest getRequest1 = new HttpGetRequest(); // Instantiate new class instance
AsyncTask<String, Void, String> result1 = getRequest.execute(parameters1);
HttpGetRequest getRequest2 = new HttpGetRequest(); // Instantiate new class instance
AsyncTask<String, Void, String> result2 = getRequest.execute(parameters2);
或:
HttpGetRequest getRequest = new HttpGetRequest(); // Instantiate new class instance
AsyncTask<String, Void, String> result1 = getRequest.execute(parameters1);
result2 = getRequest.execute(parameters2);
我想第二种选择是最好的,对吗?
经过多次(不(成功的尝试,我得出的结论是,最好的方法是为每个请求创建一个新的HttpGetRequest((,所以第一个选项!