New Asynctask<string,void,string> () {
@Override
Protected string Doinbackground (String ... strings) {
String Path=strings[0];
try {
URL url=new url (path);
HttpURLConnection con= (httpurlconnection) url.openconnection ();
if (code==200) {
InputStream Is=con.getinputstream ();
Bytearrayoutputstream baos=new Bytearrayoutputstream ();
Byte[] Buffer=new byte[1024];
int len=0;
while ((Len=is.read (buffer))!=-1) {
Baos.write (Buffer,0,len);
}
Hajjahdjhabs
Juguyg
Is.close ();
Baos.flush ();
Baos.close ();
return baos.tostring ();
}
;
} catch (Exception e) {
E.printstacktrace ();
}
return null;
}
@Override
protected void OnPostExecute (String s) {
Super.onpostexecute (s);
Gson gson=new Gson ();
Toutiao Tt=gson.fromjson (S,toutiao.class);
List=tt.data.pc_feed_focus;
Myadapter adapter=new Myadapter (mainactivity.this,list);
Listview.setadapter (adapter);
}
}.execute ("http://www.toutiao.com/api/pc/focus/");
HttpURLConnection Network Requests