Can anyone help me pls?

On Jan 1, 3:59 pm, "[email protected]"
<[email protected]> wrote:
> Hi,
>
> I'm having hard time working out how to accomplish that. In my
> activity I call my service as follows:
>
> private void startService(){
>         Intent myIntent = new Intent(this, MyService.class);
>         Bundle b = new Bundle();
>         b.putSerializable("userBean", user);
>         myIntent .putExtra("MainActivity", b);
>         startService(myIntent );
>
> }
>
> Than I try to retrieve the state from the onStart(Intent, int) method
> from my service like that:
>
> public void onStart(Intent intent, int startId) {
>         Bundle b = intent.getBundleExtra("MainActivity");
>         User user = (User) b.getSerializable("userBean");
>         Log.i("User Name:", user.getName());
>
> }
>
> Everytime the service gets called, the compiler throws a
> NullPointerException from the onStart(Intent, int) method.
>
> Pls help!
--~--~---------~--~----~------------~-------~--~----~
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