Skip to content Skip to sidebar Skip to footer

Service Callback Throws: Uncaught Remote Exception! (exceptions Are Not Yet Supported Across Processes.)

I'm having some issues with my callbacks. Here is my code: Activity: private ICallback callback = new ICallback.Stub() { @Override public void fire() throws RemoteException

Solution 1:

Like the error message says, you try to update a View from the wrong Thread. As the fire() method is called from the remote Service that runs in another Thread, you need to make sure, that the code that updates the UI runs in the UI Thread. To achieve this, try the following:

public void fire() throws RemoteException {

    //the activity provides this method to be able to run code in the UI Thread
    runOnUiThread(new Runnable(){

        @Override
        public void run(){
            mTextView.setText("fired");
        }
    })
}

Post a Comment for "Service Callback Throws: Uncaught Remote Exception! (exceptions Are Not Yet Supported Across Processes.)"