テキスト ボックスから取得した URL への単純な HTTP ヘッド リクエストを作成したいと考えています。URL を入力してクリックして HTTP 応答を取得するたびに、アプリが応答しなくなります。コードは次のとおりです。
public void MakeRequest(View v)
{
EditText mEdit;
TextView txtresponse;
txtresponse = (TextView)findViewById(R.id.textView1);
mEdit = (EditText)findViewById(R.id.editText1);
HttpClient httpClient = new DefaultHttpClient();
HttpHead httphead = new HttpHead(mEdit.getText().toString());
try {
HttpResponse response = httpClient.execute(httphead);
txtresponse.setText(response.toString());
} catch (ClientProtocolException e) {
// writing exception to log
e.printStackTrace();
} catch (IOException e) {
// writing exception to log
e.printStackTrace();
}
}