Monday, July 30, 2012

Re: [android-developers] Re: Binding service from Simple Java Class

On Mon, Jul 30, 2012 at 4:43 AM, MMM <> wrote:
If I call bindService() method, its giving me error as bindService() method is not defined.

It is defined, but in the Context class. If you don't understand why you can't arbitrarily call a method defined in another class from another unrelated class, you need to spend some more time learning Java.
 So, my question is that, do I need any class which is extended from a component like Activity/Service to bind my service or can I bind the service directly from simple Java class? 

You either extend Activity, Service or another Context-derived class yourself or you pass an instance of a Context to this simple Java class.

TreKing - Chicago transit tracking app for Android-powered devices

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment