0
如何將一個變量傳遞到AsyncTask中,就像你將函數一樣? 我想要做什麼用var httpLink將字符串發送到AsyncTask
private class getinternetData extends AsyncTask<String, Void, String>{
@Override
protected String doInBackground(String... params) {
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(httpLink);
try{
//message.setText("333");
HttpResponse response = httpclient.execute(httpget);
//message.setText("444");
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if(statusCode == 200){
return "Could connect";
}else
return "Couldn't connect";
}catch(Exception e){
return e.toString();
}
}