我试图从JSON获取数据到ListView,但每次我得到空白页,既没有获得类别列表也没有错误.
我是Android的新手,并尝试使用JSON制作多级ListView,
在我的情况下,我想只使用JSON实现这一点:类别>项目>详细信息
但我在第一个屏幕上遇到问题,甚至无法获取类别
JSON:
{
"categoryId": "1",
"categoryTitle": { "SmartPhones": [
{
"itemId": "1",
"itemTitle": "Galaxy Mega 5.8"
},
{
"itemId": "2",
"itemTitle": "Galaxy Mega 6.3"
}
]
},
"categoryId": "2",
"categoryTitle": { "Tablets": [
{
"itemId": "1",
"itemTitle": "Galaxy Note 510"
},
{
"itemId": "2",
"itemTitle": "Galaxy Note 800"
}
]}
}
Run Code Online (Sandbox Code Playgroud)
谢谢@Segi给我正确的JSON格式
活动代码:
public class CategoriesActivity extends ListActivity {
// Connection detector
ConnectionDetector cd;
// …Run Code Online (Sandbox Code Playgroud)