这是我在eclipse中的代码:它正在尝试建立与URL的连接
URL url = new URL(dataString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000 /* milliseconds */);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
int response = conn.getResponseCode();
Log.d(DEBUG_TAG, "The response is: " + response);
最后一行给出了一个错误,说“DEBUG_TAG无法解析为变量”我该怎么办?
你还没有宣布DEBUG_TAG
。在你的班级上宣布它。
例如:
字符串DEBUG_TAG =“YOUR_APP_NAME”