Android - Key Dispatching Timed Out

Solution 1:

You must be as fast as possible in your onClick implementation. Expensive operations should be, in general, offloaded to a background thread.

In onClick, try:

Thread t = new Thread(){
    public void run(){
        your_stuff();
    }
};
t.start();

instead of just

your_stuff()

Solution 2:

You can encounter this error when you block the main thread (a.k.a. the UI thread) for a few seconds. Expensive operations should be, in general, offloaded to a background thread. AsyncTask is very helpful in these cases.

In your case you could do the following:

new AsyncTask<Void, Void, Void>() {
    @Override
    protected Void doInBackground(Void... params) {
        try {
            serviceBinder.endCall(lineId);
        } catch (RemoteException e) {
            e.printStackTrace();
        } 
    }
}.execute();