AIDL use case!

AIDL does nothing but lets the system to generate the boilerplate code that hides the binder IPC details, so that you can invoke the remote service API as a local method call. Using AIDL is necessary only if you allow clients from different applications to access your service for IPC and want to handle multithreading in your service. So,If you don’t need IPC (i.e., your client and server stay in the same process), you don’t need AIDL;

If you want to write the boilerplate code yourself for IPC, you don’t need AIDL;

If your service is not complicated enough (i.e., does not require concurrent multithreaded accesses), you can use system provided Messenger API for IPC. You don’t need your own AIDL, because the Messenger API hides the AIDL usage;

To extend the case 3, if you can use any existing lib or existing API to access a service in another process, you don’t need your own AIDL. For example, you can access ActivityManagerService with existing system API, and all the AIDL stuff for IActivityManager is hidden by the system API.

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());