0
**$sql = 'select * from dish_category';
$results =$conn->query($sql);
$spots = array();  //array to parse jason from
while($spot = $results->fetch_assoc()){
     $spots[] = $spot;                                                           
    }

    foreach($spots as $key=>$value){
    $newArrData[$key] =  $spots[$key];
    $newArrData[$key]['Cat_Image'] = base64_encode($spots[$key]['Cat_Image']);
}
header('Content-type: application/json');
echo json_encode($newArrData);**

Above is the PHP code, it works perfectly fine and return JSON string, now i am confused how to parse image(decode base64) in android?

2 Answers2

0

You should do it one by one:

Nabin Bhandari
  • 15,949
  • 6
  • 45
  • 59
0
 byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT);
 Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, 
 decodedString.length); 
Ankit Aman
  • 999
  • 6
  • 15