Code example for Messenger

Methods: send

0
        }; 
        final Messenger mReceiver = new Messenger(mHandler);
                ServiceConnection conn = new ServiceConnection() {
                        @Override 
                        public void onServiceConnected(ComponentName name, IBinder service) {
                                mSender = new Messenger(service);
                                try { 
                                        Message mess = Message.obtain();
                                        Bundle b = new Bundle();
                                        b.putString("Message Type", "Pass Messenger");
                                        b.putString("whoami", "Settings");
                                        b.putParcelable("messenger", mReceiver);
                                        mess.setData(b);
                                        mSender.send(mess);
                                } catch (RemoteException e) {
                                        e.printStackTrace();
                                } 
                        } 
                        @Override 
                        public void onServiceDisconnected(ComponentName name) {}
                };