1
您好我有其他解析JSON的代碼和JSON的base64圖像正常工作:如何解析從androidw¡
try{
JSONArray json = jparser.GetJSONfromUrl(url);
for(int i =0;i <json.length();i++){
try {
JSONObject c = json.getJSONObject(i);
String vpeli = c.getString(TAG_PELI);
String vname2 = c.getString(TAG_nombre2);
} catch (JSONException e) {
// TODO: handle exception
e.printStackTrace();
return "error creando variables";
}
我要解析的json的base64圖像轉換成一個機器人的ImageView,我的JSON是:
<?php
$con = mysql_connect('mysql.hostinger.es', 'u453215752_aitor', '*******');
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
$cities['cities'] = array();
if($con)
{
mysql_select_db('u453215752_droid');
$res = mysql_query('select name, nametwo, photo from cities');
while($row = mysql_fetch_array($res)) {
array_push($cities['cities'], array('name' => $row['name'], 'nametwo' =>
$row['nametwo'], 'photo' => base64_encode($row['photo'])));
}
mysql_free_result($res);
mysql_close($con);
}
header('Content-type: application/json');
echo json_encode($cities);
我需要在imageview中解析「照片」嗎? 謝謝!