【发布时间】:2015-10-01 18:03:24
【问题描述】:
我正在尝试通过单击 android 按钮进行 Web 服务调用。我已经设法纠正了这些错误,但它在获得响应时显示了一些错误。我收到null 回复。下面是我的代码。有人可以调试我吗..!
我的代码:
refresh_btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HttpHandler httpHandler1 = new HttpHandler();
String res = null;
String authToken = "MlSyULrWlFgVk28";
try {
Log.d("edwLog", TAG + " get_payment_notifications " + HttpHandler.API_URL + "get_payment_notifications/" + authToken + "/");
res = httpHandler1.makeServiceCall(HttpHandler.API_URL + "get_payment_notifications/" + authToken + "/", HttpHandler.GET);
Log.d("edwLog", TAG + " response > " + res);
if (res != null) {
JSONObject jsonObject = new JSONObject(res);
String responseType = jsonObject.getString("type");
if (responseType.equals("success")) {
if (jsonObject.has("response")) {
JSONArray jsonArray = jsonObject.getJSONArray("response");
for (int i = 0; i < jsonArray.length(); i++) {
notifications.add(jsonArray.getJSONObject(i));
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
Log.d("edwLog", TAG + " IOException > " + e.toString());
}
}
});
【问题讨论】:
-
logcat 日志在哪里?
-
这到底是什么? :
final Bundle result = new Bundle(); return result;结果什么都不是! -
是的,这就是我的打击 Skizo..
-
应该返回什么结果?
-
@vinaysam 这不是 Logcat 错误日志 :(
标签: android button methods call