On Sat, Jul 10, 2010 at 11:53 PM, Sean Chitwood <[email protected]> wrote:
>    Currently I have this code:
>
> Intent i = new Intent();
> i.setAction(Intent.ACTION_RUN);
> i.setClass(ShowDetail.this, DownloadShowsService.class);
>
>
>
> i.putExtra(Constants.TITLE_FIELD, mShow.getTitle());
> i.putExtra(Constants.ENCLOSURE_FIELD, mShow.getMp3Path());
> i.putExtra(Constants.NOTES_URL, mShow.getPdfPath());
> i.putExtra(BaseColumns._ID, mShow.getId());
>
> bindService(i, mConnection, Context.BIND_AUTO_CREATE);
> startService(i);
> /* Make sure dssShow has been assigned to when we bind to it */
> if(dssShow != null)
>
>         {
>
>             dssShow.addListener(new PropertyChangeListener(){
>
>                  public void propertyChange(PropertyChangeEvent event) {
>
>                        if(event.getPropertyName() == "finished" &&
> (Boolean)event.getOldValue() == true)
>                         {
>                                ShowDetail.this.readShowData();
>                        }
>
>                   }
>              });
>
>  }
>
>
>
> The dssShow is always null immediately after the service starts.

Based on the code you have listed here, that's because you're never
assigning a value to dssShow.

I am not quite certain why you are calling both bindService() and
startService(). While there are occasional places where both are
required, it is a bit unusual.

Also, bear in mind that bindService() and startService() are both asynchronous.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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