//如何将url传递给json并在android中显示对listview的响应,我如何在listview中显示 public class MainActivity extends Activity {
@SuppressLint("NewApi")
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
InputStream is = null;
StrictMode.setThreadPolicy(policy);
InputStream inputStream = null;
String result = "";
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://api.learn2crack.com/android/jsonos/");
try {
HttpResponse httpresponse = httpclient.execute(httppost);
HttpEntity httpEntity = httpresponse.getEntity();
is = httpEntity.getContent();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch blockt
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}