Wednesday, May 16, 2012

Write Object in Database

To Write in DB

ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(bos); 
out.writeObject(myObj);
byte[] yourBytes = bos.toByteArray();
out.close();
bos.close();

String data = Base64.encodeToString(yourBytes, Base64.DEFAULT);
dbHelper.insertWeather(db, data);

To Read from DB

String data = cursor.getString(0);
ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(data, Base64.DEFAULT));
ObjectInput in = new ObjectInputStream(bis);
myObj = (POJO_My_Info)in.readObject();
bis.close();
in.close();;

Monday, May 7, 2012

Way to install Application on by defualt SD Card


Here i found one good solution for installing Android app to SD Card by default.

adb shell pm setInstallLocation 2 OR adb shell pm set-install-location 2