Java tutorial
//package com.java2s; import android.util.Base64; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class Main { public static String objectToString(Serializable serializableObject) throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeObject(serializableObject); objectOutputStream.close(); return new String(Base64.encode(byteArrayOutputStream.toByteArray(), 0)); } }