Category Archives: Serialization

How to find your Google Plus ID

This is so simple

1. Go to your Google + account (https://plus.google.com/).

2. Click on the Profile icon on the Left.

3. If you look at the URL in the address bar, it should look something like this:

https://plus.google.com/104653270154306099169/posts

4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven’s from the URL above:

104653270154306099169/

Google + CoderzHeaven

How to read a serialized object from a file in the raw folder in android?

In my previous post I showed how to serialize an object and save it in sdcard in a file and retrieve it.

Pull out the file from the sdcard and then create a folder named “raw” inside the “res” folder and copy it.

Serialization pull out file.
This example shows how to retreive it when it is in the res/raw folder.

Here is the code that does this.

 public void readFromResources(){
    	 try
         {
         	InputStream is = getResources().openRawResource(R.raw.save_object);
         	ObjectInputStream ois = new ObjectInputStream(is);
         	Person person = (Person)ois.readObject();
         	Log.v("Person : >> Name : ",person.getName() + ", Address : " + person.getAddress() + ", Number : " + person.getNumber());
         }
         catch(Exception ex)
         {
        	 Log.v("Serialization Error >> ",ex.getMessage());
         	 ex.printStackTrace();
         }
    }

You are done. Go on and run it.
Check the Logcat for the results.