class myAysncTask extends AsyncTask<String, Integer, String>{
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
String ss=params[0];
String st=NewWorkUtil.httpClient_Post(ss);
return st;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
Gson gson=new Gson();
Supper ss=gson.fromJson(result, Supper.class);
List<Mydata> list=ss.getResult().getData();
listView.setAdapter(new Myadpter(list, getApplicationContext()));
super.onPostExecute(result);
}
}
在oncreate方法里面加入以下代码就行了 括号里面是url地址;
new myAysncTask().execute(NewWorkUtil.JIANKANG);
时间: 2024-10-08 14:50:29