【发布时间】:2016-07-25 10:34:22
【问题描述】:
我是一名 android 初学者,请为此提供必要的帮助。
try {
JSONArray jArray = new JSONArray(result);
// Extract data from json and store into ArrayList as class objects
for (int i = 0; i < jArray.length(); i++) {
JSONObject json_data = jArray.getJSONObject(i);
DataFish fishData = new DataFish();
fishData.nonce = json_data.getString("nonce");
fishData.iUserId = json_data.getString("iUserId");
fishData.timestamp = json_data.getString("timestamp");
fishData.token = json_data.getString("token");
data.add(fishData);
}
// Setup and Handover data to recyclerview
mRVFishPrice = (RecyclerView) findViewById(R.id.fishPriceList);
mAdapter = new AdapterFish(PostActivity.this, data);
mRVFishPrice.setAdapter(mAdapter);
mRVFishPrice.setLayoutManager(new LinearLayoutManager(PostActivity.this));
}
catch (JSONException e) {
Toast.makeText(PostActivity.this, e.toString(), Toast.LENGTH_LONG).show();
}
我已将其转换为 JSONArray,但我仍在获取
org.json.JSONException: Value {"code":"0","message":"拒绝访问, org.json.JSONObject 类型的无效用户引用"} 不能是 转换为 JSONArray。
【问题讨论】:
-
发布您的 JSON 数据。
-
首先检查你的代码是o还是1。如果代码1获取数组值
-
使用码键整数
-
我已经在doinbackground方法中发布了JSON数据
-
不,我的意思是发布您从服务器获得的 JSON 响应。
标签: android json android-asynctask