Hi Rashmi,

You have to create your Handler in separate thread.
Then you can run that thread in your onCreate() of your Service2, like new 
LooperThread();

 public Handler mHandler; // Your handler

  class LooperThread extends Thread {
     

      public void run() {
          Looper.prepare();

          mHandler = new Handler() {
              public void handleMessage(Message msg) {
                  // process incoming messages here
              }
          };

          Looper.loop();
      }
  }


For more info you can look here 
http://developer.android.com/reference/android/os/Looper.html

Regards,
Yuvi

On Wednesday, February 26, 2014 5:22:11 PM UTC+5:30, Rashmi wrote:

> Hi,
>
> I am binding from service1 in app1 to service2 in app2 through aidl. In 
> service2 to I have defined the aidl stub api's which has some handler.
> If I tried to access the service2 api through binder from service1, I am 
> getting the following exception
>
>  "java.lang.RuntimeException: Can't create handler inside thread that has 
> not called Looper.prepare()"
>
> I am not creating any thread explicitly. Please let me know from where I 
> can call Looper.prepare().
>
> Thank you,
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to