本文整理匯總了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);
}
});
}