1

I have Remote Service in a separate process and in this Remote Service for example I am calling a method that throw Custom Runtime Exception if something wrong. - I want to handle that exception in UI.

But as I understand I cannot throw exception from one process to another. What is solution for this situation?

UPDATED: I am getting:

E/JavaBinder(1544): *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
user1074896
  • 1,025
  • 2
  • 15
  • 27
  • Show your code , also detail of logcat to get the issue details. – Arslan Anwar Feb 02 '12 at 11:28
  • 1
    Problem is that is I throw CustomRuntimeException that cannot implement Parcelable interface so I am getting: 01-01 00:49:24.997: W/System.err(1486): java.lang.NullPointerException 01-01 00:49:25.017: W/System.err(1486): at android.os.Parcel.readException(Parcel.java:1240) – user1074896 Feb 02 '12 at 11:38

1 Answers1

1

I think you can but it is not so easy. To do this you should manually realize IPC communication between your service and activity. I.e. you should make an your Interface that extends IInterface. After that you should manually realize Stub and Proxy classes for this interface. And in this classes you should manually realize communication between this proxy and stub classes (i.e. here you can send exceptions between processes).

I think that it's easier to send for instance integer in your case. And in Activity just check this integer value. If it is equal to predefined value, you can throw your Custom Runtime Exception.

Yury
  • 20,618
  • 7
  • 58
  • 86