SharedPreference sharedPrefrences=getSharedPreference("test",Context.MODE_PRIVATE);
Object object=new Object();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(object);
// 对byte[]进行Base64编码
String deviceease64 = new String(Base64.encode(baos.toByteArray(),
Base64.DEFAULT));
Editor editor = sharedPrefrences.edit();
editor.putString("device", deviceease64);
editor.commit();// 提交