Re: [android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread rich friedel
I solved a similar issue by broadcasting that my service is actually active and running and then if my activity is active it receives that broadcast and does what it needs to do. This way the Activity always "knows" when the service is active. The onBind is not applicable to my situation as my

Re: [android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread Mark Murphy
On Fri, Jul 22, 2011 at 4:35 AM, Animesh Sinha wrote: > You are right in saying that android requires developers to write an > event-driven code and that effort needs to be put for designing the > whole chain of events. > > But for the following case as shown below, I don't think one can get > rid

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread Animesh Sinha
Thanks Chris for replying. You are right in saying that android requires developers to write an event-driven code and that effort needs to be put for designing the whole chain of events. But for the following case as shown below, I don't think one can get rid of the NullPointerException thrown in

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread gjs
Hi, You can just start the service via an intent and also pass details about the function(s) you want executed, but you won't get anything returned from the function(s) invoked in the service being sent back to the activity directly, you will have to use the usual interfaces otherwise. Regards O

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Chris Stratton
On Thursday, July 21, 2011 1:26:54 AM UTC-4, Animesh Sinha wrote: > The issue is that I need to call the service methods as soon as it is > connected. > So, Is there any way by which I can execute the functions of service > JUST AFTER binding is complete ? > > It takes around 10-20ms for bindi

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Animesh Sinha
Executing the function calls in onServiceConnected() method is not what is wanted as described in following case: There is a Service Wrapper class where the binding/unbinding is actually done. The MyServiceClient is an Activity class used for invoking some functions on the service using the Servic

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Animesh Sinha
Executing the function calls in onServiceConnected() method is not what is wanted as described in following case: CODE SNIPPET class ServiceWrapperClass { private ISomeServiceInterface myService .. private ServiceConnection progressBarServiceCo

Re: [android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Mark Murphy
On Thu, Jul 21, 2011 at 1:26 AM, animeshsi wrote: > The issue is that I need to call the service methods as soon as it is > connected. > So, Is there any way by which I can execute the functions of service > JUST AFTER binding is complete ? Execute those "functions" in onServiceConnected(). --

[android-developers] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-20 Thread animeshsi
Thanks Mark for replying. The issue is that I need to call the service methods as soon as it is connected. So, Is there any way by which I can execute the functions of service JUST AFTER binding is complete ? It takes around 10-20ms for binding, I tried to make use Thread.sleep(30); but it delaye