Thanks, I am trying to run it on the UI thread but via the Service.

Have implemented a work around for now anyway and will re visit this when I
have time to study and recode it properly.

Thanks

On Mon, Sep 13, 2010 at 5:32 PM, String <[email protected]>wrote:

> Donal,
>
> I'm mildly surprised Mark Murphy hasn't chimed in on this himself, but
> here's a current post from his blog which looks relevant:
>
> http://commonsware.com/blog/2010/09/10/asynctask-screen-rotation.html
>
> HTH,
>
> String
>
> On Sep 13, 1:05 pm, Donal Rafferty <[email protected]> wrote:
> > I have managed to implement the Task in my Service now but the original
> > problem still remains.
> >
> > I dont cancel the Task at all in my service, I simply play the ringtone
> in
> > the postExecute method of the Asynctask if a flag is true, if its not I
> > dont.
> >
> > But I get the same issue, after a couple of runs the AsyncTask simply
> stops
> > getting to the doInBackground method, only the postExecute method is run.
> >
> > Its very strange and really annoying me now.
> >
> > Is there any reason why an AsyncTask would behave like this without
> cancel
> > being used?
> >
> >
> >
> > On Mon, Sep 13, 2010 at 10:58 AM, Donal Rafferty <[email protected]>
> wrote:
> > > Monday morning coding! :)
> >
> > > I return my aidl definition in my service's onBind:
> >
> > > @Override
> > >     public IBinder onBind(Intent arg0) {
> > >         Log.d("XXX", "Status: onBind Called");
> > >         return myServiceStub;
> > >     }
> >
> > >     IBinder myServiceStub = new IMyService.Stub(){
> >
> > >      //aidl methods
> >
> > >     };
> >
> > > And use this to call methods from my Activity, so I would need to be
> able
> > > to import android.media.Ringtone in my aidl definition but I cant.
> >
> > > So I'm still stuck with it not working :(
> >
> > > On Mon, Sep 13, 2010 at 10:32 AM, Kostya Vasilyev <[email protected]
> >wrote:
> >
> > >>  Donal,
> >
> > >> No, a service is a service, and a binder is a binder.
> >
> > >> The binder you get in the callback is the binder returned by the
> service's
> > >> onBind.
> >
> > >> This example:
> >
> > >>http://developer.android.com/resources/samples/ApiDemos/src/com/examp.
> ..
> >
> > >> has a binder implementation that returns a reference to its service,
> so
> > >> you can do this
> >
> > >> public void onServiceConnected(ComponentName className,
> > >>              IBinder binder) {
> >
> > >> LocalService.LocalBinder binder = (LocalService.LocalBinder) binder;
> > >> *LocalService service = binder.getService();*
> > >> }
> >
> > >> This example has one flaw: it leaks a service reference (since
> LocalBinder
> > >> is a non-static inner class of LocalService). Using a static inner or
> a
> > >> top-level class for LocalBinder, fixes that (AFAIK).
> >
> > >> -- Kostya
> >
> > >> 13.09.2010 13:16, Donal Rafferty пишет:
> >
> > >> 09-13 10:06:53.566: ERROR/AndroidRuntime(18791): Uncaught handler:
> thread
> > >> main exiting due to uncaught exception
> > >> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):
> > >> java.lang.ClassCastException: com.xxx.phone.MyService$1
> > >> 09-13 10:06:53.676: ERROR/AndroidRuntime(18791):     at
> > >> com.xxx.phone.ui.MyActivity$2.onServiceConnected(MyActivity.java:515)
> >
> > >> So it doesn't like the cast from binder to Service?
> >
> > >> How can I fix that do you know? What am I missing from the example?
> >
> > >> --
> > >> Kostya Vasilyev -- WiFi Manager + pretty widget --
> http://kmansoft.wordpress.com
> >
> > >>  --
> > >> 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]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/android-developers?hl=en
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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