Note: This is an article I published earlier on eoe. Since each application runs in its own process space and can run another service process from the application UI, objects are often transferred between different processes. On the Android platform, a process generally cannot access the memory space of another process. Therefore, to perform a conversation, you need to break down the object into basic units that the operating system can understand and orderly pass through the process boundary. The following describes how to implement AIDL calling. This article includes AIDL interface calling and callback, and passing a Demo of complex data types to run the Aidl file Person. aidl package com. archermind. aidl; parcelable Person; ITaskBinder. aidl package com. archermind. aidl; import com. archermind. aidl. ITaskCallBack; import com. archermind. aidl. person; interface ITaskBinder {void fuc01 (); void fuc02 (); String fuc03 (in Person person); void registerCallBack (ITaskCallBack cb); void unregisterCallBack ();} ITaskCallBack. aidl package com. archermind. aidl; interface ITaskCallBack {void onActionBack (String str);} first, the Code server of Myservice implements the relevant AIDL interfaces for the client to call @ Override public IBinder onBind (Intent arg0) {// TODO Auto-generated method stub return mBinder;} private final ITaskBinder. stub mBinder = new ITaskBinder. stub () {@ Override public void unregisterCallBack () throws RemoteException {// TODO Auto-generated method stub Log. v (TAG, "unregisterCallBack... "); mTaskCallBack = null;} @ Override public void registerCallBack (ITaskCallBack cb) throws RemoteException {// TODO Auto-generated method stub Log. v (TAG, "registerCallBack... "); mTaskCallBack = cb ;}@ Override public void fuc01 () throws RemoteException {// TODO Auto-generated method stub Log. v (TAG, "fuc01... ") ;}@ Override public void fuc02 () throws RemoteException {// TODO Auto-generated method stub Log. v (TAG, "fuc02... "); mTaskCallBack. onActionBack ("hello world") ;}@ Override public String fuc03 (Person person) throws RemoteException {// TODO Auto-generated method stub String name = Person. getName (); String descrip = person. getDescrip (); int sex = person. getSex (); String ret = ""; if (sex = 0) {ret = "Hello" + name + ", you are handsome "+" ("+ descrip +") ";} else {ret =" Hello "+ name + ", you are beautiful "+" ("+ descrip +") ";}return ret ;}; the client implements the callback interface private final ITaskCallBack. stub mCallBack = new ITaskCallBack. stub () {@ Override public void onActionBack (String str) throws RemoteException {// TODO Auto-generated method stub Log. v (TAG, "onActionBack str =" + str) ;}}; how does the client bind to the server and establish a connection Intent intent = new Intent ("com. archermind. aidl. myservice "); bindService (intent, mConnection, BIND_AUTO_CREATE); private ServiceConnection mConnection = new ServiceConnection () {@ Override public void onServiceConnected (ComponentName, IBinder service) {// TODO Auto-generated method stub mService = ITaskBinder. stub. asInterface (service); try {mService. registerCallBack (mCallBack);} catch (RemoteException e) {// TODO Auto-generated catch block e. printStackTrace ();} Log. v (TAG, "onServiceConnected ");}