Monday, July 30, 2012

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

On Mon, Jul 30, 2012 at 4:43 AM, MMM <monikamitkar@gmail.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment