Well,
are you calling it after you have binded ?
You are mentioning onCreate(), I just hope the code-sequence is the
right one, thus something like :

myServiceIntent = new Intent(this,service.class);
this.bindService(myServiceIntent, mConnection,
Context.BIND_AUTO_CREATE);

On 25 jun, 11:40, vineet <[email protected]> wrote:
> i am usign a very simple scenario.
> i have a remote service created and binded properly.
> I can access service methods as described in the aidl interface but
> only from the click listener, and can never access using it using
> onCreate or other functions.
>
> i have tried 3 different approaches as available on books or net to
> consume service. however result is same.
>
> for instance if i create mSercvice as my Service class variable and in
> the interface i have method getStatus() which returns boolean.
>
> now after binding service if i call mService.getStatus() from
> onClickListener or ServiceConnection Stub, ican access very easily
> without a error.
> but if i try to get from onCreate (my app fetches parameter status
> from service), the value of mService gets null and system exits with
> Force Close (due to nullpointexception as from log).
>
> Now can somone please help, as i dont think the value should be null
> since the variable is declared globally. so how does the stuff goes..
>
> One of my friend on this group told, if you dont get output all times,
> its a bug.
>
> sorry for bad english...

-- 
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

Reply via email to