Use AIDL or Messenger Queue?

AIDL is for the purpose when you’ve to go application level communication for data and control sharing, a scenario depicting it can be: An app requires list of all contacts from Contacts app (content part lies here) plus it also wants to show the call’s duration and you can also disconnect it from that app (control part lies here).

In Messenger Queues you’re more IN the application and working on threads and processes to manage the queue having messages so no Outside services interference here.

Messenger is needed if you want to bind a remote service (e.g. running in another process).

How would you save Activity state during a screen rotation?

When your orientation changes, you don’t have to manually change to the landscape layout file. Android does this automatically for you. When orientation changes, Android destroys your current activity and creates a new activity again, this is why you are losing the text.

Basically, whenever Android destroys and recreates your Activity for orientation change, it calls onSaveInstanceState() before destroying and calls onCreate() after recreating. Whatever you save in the bundle in onSaveInstanceState, you can get back from the onCreate() parameter.

private TextView mTextView;
private static final String KEY_TEXT_VALUE = "textValue";
protected void onCreate(Bundle savedInstanceState) {
  mTextView = (TextView) findViewById(;
  if (savedInstanceState != null) {
      CharSequence savedText = savedInstanceState.getCharSequence(KEY_TEXT_VALUE);

protected void onSaveInstanceState (Bundle outState) {
   outState.putCharSequence(KEY_TEXT_VALUE, mTextView.getText());