I am binding a remote service from an activity and unbind the same on the
onPause of the Activity,when the activity again restarts i bind the service
.It does bind with the remote service and i am also successful in getting
the remote-service method getting executed after the restart.But when
returning a message from the callback-RemoteCallbackList.the
mCallbacks.beginBroadcast returns me 0 clients.Am i missing some thing here
?why am i am getting zero clients when I call mCallbacks.beginBroadcast.??

-----------------------------------------------------------------
@Override
    public void onDestroy() {

        // Unregister all callbacks.
        mCallbacks.kill();

        System.out.println("I am destroyin");

    }
@Override
    public IBinder onBind(Intent intent) {
        if (IRemoteWSService.class.getName().equals(intent.getAction())) {

            return mBinder;
        }
        if (IWSSecondary.class.getName().equals(intent.getAction())) {

            return mSecondaryBinder;
        }

        return null;
    }
private final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {

            // It is time to bump the value!
            case ONSUCCES: {

                System.out.println("Remote ONSUCCES");
                // Broadcast to all clients the new value.
                final int N = mCallbacks.beginBroadcast();
                System.out.println("n "+N);
                for (int i = 0; i < N; i++) {
                    try {


mCallbacks.getBroadcastItem(i).onSuccess(successBundle);
                    } catch (RemoteException e) {
                        // The RemoteCallbackList will take care of removing
                        // the dead object for us.
                    }
                }
                mCallbacks.finishBroadcast();
            }
                break;
            // It is time to bump the value!
            case ONERROR: {
                //System.out.println("Remote ONERROR");

                // Broadcast to all clients the new value.
                final int N = mCallbacks.beginBroadcast();
                for (int i = 0; i < N; i++) {
                    try {

                            mCallbacks.getBroadcastItem(i).onError();
                    } catch (RemoteException e) {
                        // The RemoteCallbackList will take care of removing
                        // the dead object for us.
                    }
                }
                mCallbacks.finishBroadcast();

            }
}
}
---------------------------------------------------------

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to