KK wrote: > hi Pskink, > That actually worked, I moved the timer.cancel() before releasing the > mediaplayer. But what is the logical reasoning behind this, would you mind > explaining in a word or two? or may be point me to any web reference that > explains the thing. Thanks in advance. > > Regards, > KK > > On Sat, Nov 26, 2011 at 1:56 PM, skink <[email protected]> wrote: > > > > > > > KK wrote: > > > hi, > > > Seems the logcat > > > > > > 11-26 13:32:06.727: ERROR/AndroidRuntime(10779): FATAL EXCEPTION: Timer-0 > > > 11-26 13:32:06.727: ERROR/AndroidRuntime(10779): > > > java.lang.IllegalStateException > > > 11-26 13:32:06.727: ERROR/AndroidRuntime(10779): at > > > android.media.MediaPlayer.getCurrentPosition(Native Method) > > > 11-26 13:32:06.727: ERROR/AndroidRuntime(10779): at > > > > > com.infineon.musicplayer4mNet.MusicPlayerActivity$2.run(MusicPlayerActivity.java:174) > > > 11-26 13:32:06.727: ERROR/AndroidRuntime(10779): at > > > java.util.Timer$TimerImpl.run(Timer.java:284) > > > > > > > > > > > > Try to cancel() the timer before releazing media player > > > > Also try to avoid Timer/TimerTask, use Handler instead > > > > pskink > > > > -- > > 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 > >
Btw if you still use Timer/TimerTask combination you can still sometimes face your problem since Timer uses its own Thread for running TimerTasks. In order to avoid this you will need to implement some synchronization. Or use Handlers pskink -- 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

