2012-05-11 106 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 –