-1

Is there any way that I can convert a base64 String to image in Android? I am receiving this base64 String in a xml from the server connected through socket.

I recuperate a image from json object and i need to set image of item RecyclerView someone have a tuto to retrive img and set in RecyclerView

 String Img = currentobject.getString("image"); byte[] imageAsBytes = Base64.decode(Img.getBytes(), Base64.DEFAULT); ImageView image = (ImageView)findViewById(R.id.img_user); image.setImageBitmap( BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length) ); persone= new persone(id,name,img); personnes.add(persone); //in my adapter //i use this Glide.with(context) .load(persone.getImage()) .apply(RequestOptions.circleCropTransform()) .into(holder.thumbnail); 
1

1 Answer 1

1
byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT); Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.