How can I save an activity state using the save instance state?

I’ve been working on the Android SDK platform, and it is a little unclear how to save an application’s state. So given this minor re-tooling of the ‘Hello, Android’ example: package com.android.hello; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { private TextView mTextView = null; /** Called when the activity is … Read more

How to pass an object from one activity to another on Android

One option could be letting your custom class implement the Serializable interface and then you can pass object instances in the intent extra using the putExtra(Serializable..) variant of the Intent#putExtra() method. Pseudocode: //To pass: intent.putExtra(“MyClass”, obj); // To retrieve object in second Activity getIntent().getSerializableExtra(“MyClass”); Note: Make sure each nested class of your main custom class has implemented Serializable interface to avoid … Read more