【发布时间】:2010-12-31 06:16:18
【问题描述】:
所以我有这个 JSON,然后我的活动将其检索到一个字符串:
{"popular":
{"authors_last_month": [
{
"url":"http://activeden.net/user/OXYLUS",
"item":"OXYLUS",
"sales":"1148",
"image":"http://s3.envato.com/files/15599.jpg"
},
{
"url":"http://activeden.net/user/digitalscience",
"item":"digitalscience",
"sales":"681",
"image":"http://s3.envato.com/files/232005.jpg"
}
{
...
}
],
"items_last_week": [
{
"cost":"4.00",
"thumbnail":"http://s3.envato.com/files/227943.jpg",
"url":"http://activeden.net/item/christmas-decoration-balls/75682",
"sales":"43",
"item":"Christmas Decoration Balls",
"rating":"3",
"id":"75682"
},
{
"cost":"30.00",
"thumbnail":"http://s3.envato.com/files/226221.jpg",
"url":"http://activeden.net/item/xml-flip-book-as3/63869",
"sales":"27",
"item":"XML Flip Book / AS3",
"rating":"5",
"id":"63869"
},
{
...
}],
"items_last_three_months": [
{
"cost":"5.00",
"thumbnail":"http://s3.envato.com/files/195638.jpg",
"url":"http://activeden.net/item/image-logo-shiner-effect/55085",
"sales":"641",
"item":"image logo shiner effect",
"rating":"5",
"id":"55085"
},
{
"cost":"15.00",
"thumbnail":"http://s3.envato.com/files/180749.png",
"url":"http://activeden.net/item/banner-rotator-with-auto-delay-time/22243",
"sales":"533",
"item":"BANNER ROTATOR with Auto Delay Time",
"rating":"5",
"id":"22243"},
{
...
}]
}
}
它也可以访问here,虽然它因为它是一个相当长的字符串,我已经将上面的内容修剪下来以显示需要的内容。
基本上,我希望能够从“items_last_week”访问项目并创建它们的列表 - 最初我的计划是让“缩略图”在左侧,旁边有“项目”,但从播放今天使用 SDK 似乎太难或不可能实现这一点,所以我很乐意在列表中包含来自“items_last_week”的“item”数据。
来自 php 我正在努力使用 Java 可用的任何 JSON 库,因为它似乎不仅仅是我需要反序列化的一行代码(我认为这是正确的词) JSON,它们似乎都需要某种形式的附加类,除了我拥有的 JSONArray/JSONObject 脚本,它不喜欢 items_last_week 嵌套的事实(再次,我认为这是 JSON 术语)并且需要很长时间在 Android 模拟器上运行。
因此,实际上,我需要一种(最好是简单的)方法将 items_last_week 数据传递给 ListView。我知道我需要一个自定义适配器,我可能可以理解但我无法理解,无论我花了多少时间试图弄清楚如何访问 JSON 字符串的某些部分..
【问题讨论】:
-
您需要 Json 帮助吗?然后你可以在你的问题中添加 Json 标签。
-
一个“java”标签也是合适的。