2012-05-11 93 views
0

我怎么能得到从php pageMYSQL数据库中获取信息使用相同的关键字“example”,并在数组中插入从该列("example"列)所有的值更JSON object,像:从MySQL获得JSON对象数组

exemple_array[1] = (first value of column example) from the Mysql database

任何人都可以帮助我或给我一些教程或有用的提示吗?

回答

1

首先,它来自MySql数据库并不重要,只是服务器向您返回JSON结构。

Android提供了JSON解析类,它们非常易于使用:JSONObject和JSONArray。如果你事先知道是什么格式将是,你可以轻松地与JSON数据的字符串中使用它们,你从远程服务器接收(只要你有HTTP的东西制定了已经)

http://developer.android.com/reference/org/json/JSONArray.html

http://developer.android.com/reference/org/json/JSONObject.html

+0

任何人都可以帮助我吗? http://stackoverflow.com/questions/10537511/json-mysql-get-two-integers-and-a-string/10551010#10551010 –