private HttpClient client = null; // 未實例化
// ...
HttpResponse response = client.execute(get); // NPE
在使用前初始化:
private HttpClient client = new DefaultHttpClient(); // 或在 onCreate 中
// 釋放資源
@Override protected void onDestroy() {
if (client != null) client.getConnectionManager().shutdown();
super.onDestroy();
}