JSON形式のWebサービスを介して画像が送信されています。{"notif_detailsResult":[{"image":[255,216,255,224,0,16,74,....
Android の Imageview に画像を表示したい。json を解析した後、画像の値を文字列に格納できます
@Override
protected String doInBackground(String... params) {
String epc = params[0];
String result = null;
String url = "http://192.168.142.1:90/Service1.svc/notif?notif_id=24";
try {
BufferedReader inStream = null;
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpR = new HttpGet(url);
httpR.setHeader("Accept", "application/json");
httpR.setHeader("Content-type", "application/json");
HttpResponse response = httpClient.execute(httpR);
System.out.println("HERE in product display after exectunig response");
inStream = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb = new StringBuffer("");
String line = "";
String NL = System.getProperty("line.separator");
while((line = inStream.readLine()) != null)
{
sb.append(line + NL) ;
}
inStream.close();
result = sb.toString();
} catch(Exception e){
e.printStackTrace();
}
return result;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
try {
JSONObject jObject = new JSONObject(result);
JSONArray array = jObject.getJSONArray("notif_detailsResult");
JSONObject jObject1 = array.getJSONObject(0);
String data = jObject1.getString("image");