I already flush(), stop(), and release() when I clean up. How do I
tell when AudioTrack is done?

On Sep 9, 2:13 pm, niko20 <nikolatesl...@yahoo.com> wrote:
> You definitely have to guarantee that any AudioTrack instances are
> done playing (stopped) AND released BEFORE you call finish().
> Otherwise you will get Null exceptions on your app closing, just as
> you found.
>
> So basically if you have another thread you have to put some kind of
> flag that waits for the AudioTrack to actually clear and release
> before your app exits.
>
> -niko
>
> On Sep 9, 11:33 am, OldSkoolMark <m...@sublimeslime.com> wrote:
>
> > I did a little more homework:
>
> >http://stackoverflow.com/questions/3483182/activity-finish-method-wai...
>
> > This makes me feel better about calling finish() and then
> > startActivity(). I may take the refactoring advice,
> > but in the meantime, I've isolated the problem to a thread that uses
> > AudioTrack to play short samples. I've arranged for it not to be
> > running
> > when the UI is being reset and all is good.
>
> > On Sep 8, 1:09 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > > On Wed, Sep 8, 2010 at 3:44 PM, OldSkoolMark <m...@sublimeslime.com> 
> > > wrote:
> > > > Alternative design approaches would also be greatly appreciated.
>
> > > Step #1: Refactor such that your UI initialization is not in
> > > onCreate(), but is in some other private method (referred to here as
> > > setupViews()).
>
> > > Step #2: In onResume(), on a change in layout, call setupViews().
>
> > > Step #3: There is no step #3.
>
> > > In other words, why destroy and recreate the activity just to load in
> > > a different layout? Heck, developers grumble constantly about Android
> > > doing that by default for orientation changes...
>
> > > --
> > > Mark Murphy (a Commons 
> > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > Android Training in London:http://skillsmatter.com/go/os-mobile-server
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to