Android examples for File Input Output:Byte Array Convert
serialize object to byte array
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import android.util.Log; public class Main { public static byte[] serialize(Object obj) { try {/*w w w. j a v a 2 s .c o m*/ ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream os = new ObjectOutputStream(out); os.writeObject(obj); return out.toByteArray(); } catch (Exception e) { e.printStackTrace(); } return null; } }