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

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

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

A Flash Light App in Sketchware

How to enable download in webview in Sketchware apps?

Intent - Open File By Type

Code for implementing Notifications in Sketchware

How to share an image from Drawable folder?

ActionBar back button

Animation Transtition Animation