我正在尝试使用AsyncTsk for SwipeRefreshLayout从三个.svc点网络Web服务加载数据。但SwipeRefreshLayout显示所有的时间,只有两个服务立即工作和完成,另外三个服务花了太多时间(25到30分钟)从服务器加载数据。有人建议我如何快速工作SwipeRefreshLayout。
这是我的SwipeRefreshLayout代码
public static void main(String[] args){
System.out.println("Entered inside the program....");
Scanner console=new Scanner(System.in);
System.out.println("Enter an input...");
String s=console.next();
if(null==s || !isInt(s)){
System.out.println("Entered input is not a valid integer:"+s);
}
System.out.println("Entered input is a valid integer");
}
private static boolean isInt(String arg){
try{
Integer.parseInt(arg);
return true;
}catch(NumberFormatException nfe){
return false;
}
}
这是AsyncTask代码
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//Refreshing data on server
GetDataTask asyncTask2 = new GetDataTask();
asyncTask2.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
});
先谢谢。