Graphics Bitmap To String

//Bitmap to String:

public String BitMapToString(Bitmap bitmap){
      java.io.ByteArrayOutputStream baos=new  java.io.ByteArrayOutputStream();
      bitmap.compress(Bitmap.CompressFormat.PNG,100, baos);
      byte [] arr=baos.toByteArray();
      String result=Base64.encodeToString(arr, Base64.DEFAULT);
      return result;
}


//String to Bitmap:
public Bitmap StringToBitMap(String image){
   try{
      byte [] encodeByte=Base64.decode(image,Base64.DEFAULT);
      Bitmap bitmap=BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
      return bitmap;
   }catch(Exception e){
      e.getMessage();
      return null;
   }
 }

Komentar

Cara pembuatan Apps paling Populer

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

Codes for modifying Action Bar in Sketchware

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Firebase Login/Register with email verification