Wie bekomme ich ein Bitmap-Bild von InputStream(base64 String)
in Android?Wie bekomme ich Bitmap-Bild von Instream (Base64 String) in Android?
Unten ist mein Code:
protected Bitmap doInBackground(Void... params) {
Bitmap image;
URL url1 = null;
try {
url1 = new URL("http://sunnyfacemash.atwebpages.com/get.php"); // url
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
image = BitmapFactory.decodeStream(url1.openConnection().getInputStream());
return image;
} catch (IOException e) {
image = null;
e.printStackTrace();
}
return image;
}
gerade eröffnet url Ihre php in Browser ist es base64 String es einige Zeichenfolge anzeigt? –
Ja, es ist eine Base64-Zeichenfolge. Ich möchte diese Zeichenfolge und Bild in Android anzeigen. –
https://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeStream%28java.io.InputStream%29 –