最后我放弃了,我需要你们的帮助,我有一个简单的问题,
我从这个链接有一个很棒的教程: http ://wptrafficanalyzer.in/blog/android-json-parsing-with-jsonobject-and-loading-to-listview-example/
在该教程中,使用 json 对象数组,如下所示:
"{ " +
" \"countries\":[ " +
"{" +
"\"countryname\": \"India\","+
"\"flag\": "+ R.drawable.india + ","+
"\"language\": \"Hindi\","+
"\"capital\": \"New Delhi\"," +
"\"currency\": {" +
"\"code\": \"INR\", " +
"\"currencyname\": \"Rupee\" " +
"}" +
"}, " +
"{" +
"\"countryname\": \"Pakistan\","+
"\"flag\": "+ R.drawable.pakistan + ","+
"\"language\": \"Urdu\","+
"\"capital\": \"Islamabad\"," +
"\"currency\": {" +
"\"code\": \"PKR\", " +
"\"currencyname\": \"Pakistani Rupee\" " +
"}" +
"}," +
"{" +
"\"countryname\": \"Sri Lanka\","+
"\"flag\": "+ R.drawable.srilanka + ","+
"\"language\": \"Sinhala\","+
"\"capital\": \"Sri Jayawardenapura Kotte\"," +
"\"currency\": {" +
"\"code\": \"SKR\", " +
"\"currencyname\": \"Sri Lankan Rupee\" " +
"}" +
"}" +
"]" +
"} "
不,我的问题是,我只需要解析这个简单的 json
"{ " +
" \"countries\": " +
"{" +
"\"countryname\": \"India\","+
"\"flag\": "+ R.drawable.india + ","+
"\"language\": \"Hindi\","+
"\"capital\": \"New Delhi\"," +
"\"currency\": {" +
"\"code\": \"INR\", " +
"\"currencyname\": \"Rupee\" " +
"}" +
"} "
那只是jsonobject,我必须在哪里更改代码?