【发布时间】:2017-12-26 11:06:09
【问题描述】:
我已将 JSonarray 数据作为字符串获取并将其添加到 arraylist 中,即 这是在标签片段回收器视图上完成的。
JSONObject jsonObject = response.getJSONObject(index);
// Log.d("TAG", jsonObject.getString("title"));
int id =jsonObject.getInt("id");
String title=jsonObject.getString("title");
// Log.d("TAG", jsonObject.getString("description"));
String shortDec=jsonObject.getString("description");
String longDec=jsonObject.getString("short_description");
String imguUrl=jsonObject.getString("image");
String createdAt=jsonObject.getString("created_at");
// Toast.makeText(NewsDetailsActivity.this, "\nTitle: "+title+"\n Description:", Toast.LENGTH_SHORT).show();
NewsListGetter newsListGetter=new NewsListGetter(id, title, shortDec,longDec,imguUrl,createdAt);
arrayList.add(newsListGetter);
adapter.notifyDataSetChanged();
我有另一个名为 NewsDetailsAcivity 的活动,我在其中实现了一个回收器视图。 我只想将点击的 tab1fragment 的 recylerview 中的数据传递给 newsDetailActivity recylerview。
【问题讨论】:
-
请发布
JSON示例 -
@Ziat JSONArray 中有对象吗?
-
在这里发布你的 json
-
ec2-54-147-238-136.compute-1.amazonaws.com/hmc/api/… 这是 json 的链接.. 请先生看看@Alexey #Shivam #nihal
-
@ShivamOberoi ec2-54-147-238-136.compute-1.amazonaws.com/hmc/api/... 这是 json 的链接 .. 请先生看看
标签: json arraylist android-recyclerview