本文整理汇总了Java中khandroid.ext.apache.http.impl.client.DefaultHttpClient类的典型用法代码示例。如果您正苦于以下问题:Java DefaultHttpClient类的具体用法?Java DefaultHttpClient怎么用?Java DefaultHttpClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultHttpClient类属于khandroid.ext.apache.http.impl.client包,在下文中一共展示了DefaultHttpClient类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import khandroid.ext.apache.http.impl.client.DefaultHttpClient; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act__new_http_client);
mTvResult = (TextView) findViewById(R.id.tv_result);
Button btnSimpleRequest = (Button) findViewById(R.id.btn_simple_request);
btnSimpleRequest.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Usually getting the request queue shall be in singleton like in {@see Act_SimpleRequest}
// Current approach is used just for brevity
RequestQueue queue = Volley
.newRequestQueue(Act_NewHttpClient.this,
new ExtHttpClientStack(new DefaultHttpClient()));
StringRequest myReq = new StringRequest(Method.GET,
"http://www.google.com/",
createMyReqSuccessListener(),
createMyReqErrorListener());
queue.add(myReq);
}
});
}