MediaPlayer blocked(AudioFlinger write blocked) while playing animation

by quill » Fri, 20 May 2011 15:19:15 GMT


Sponsored Links
 Hi all,

I have a thread to play audio and animation together. It's a frame
animation. The drawable resources are in sdcard. When I play the
animation, I use a handler to send message to refresh images one by
one.
Here's my code:
final Handler handle = new Handler(){
     public void handleMessage(Message msg){
          super.handleMessage(msg);
          BitmapDrawable bmpDraw = new BitmapDrawable("sdcard/
anim/"+msg.obj);
          imageView.setBackgroundDrawable(bmpDraw);
          imageView.invalidate();
          if(msg.what < fileNames.length-1){
              sendMessageDelayed(obtainMessage((msg.what+1),
fileNames[msg.what+1]),50);
         }
     }
};
handler.sendMessage(handler.obtainMessage(0,fileNames[0]);
MediaPlayer mp = new MediaPlayer();
...//play audio

The animation performs fine, but the audio will be stopped when it
begins to play for seconds. From logcat I see AudioFlinger: write
blocked for 89 msec...

I don't use AnimationDrawable because there are many images in sdcard,
when I use addFrame(AnimationDrawable.createFromPath(...)) I got an
OutOfMemory Exception.

Am I doing the right thing? Can anyone help me?

-- 



Other Threads

1. ListView Scroll behaviour

Hey guys & girls,

Can someone tell me what the default scroll behavior of a ListView is?

 I am seeing what I believe to be an odd UX. If I use the scroll ball
on the dream and scroll from a button at the top of a screen into a
listView the listView instead of then selecting one of its list items
and scrolling through them decides to scroll it's self until it
scrolls to the bottom and then it start selecting items inside (it's
children) is there any way to switch this scroll effect off so it only
scrolls down when a child is selected out of the current view portal?

I have already switched focus of the ListView to false this doesn't
seem to have helped.

Thanks,

Tom

-- 

2. How to test if app is shown on Market for all screensizes

Hi!

We have uploaded a new version of our app where we added the following to
the manifest:

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>

However, we are receiving complaints that users cannot find the app on the
market using their HTC Tattoo and HTC Dragon phones. Any ideas what we are
doing wrong, and is there a way for the developers to test if the app is
visible on the market?

Cheers!

-- 

3. How can I know date changed? seems android.intent.action.DATE_CHANGED works not properly

4. Custom Drawable (Gradient) based on Theme

5. Detecting enter key from virtual keyboard

6. Extend "Edit Contact" view with new field

7. listactivity xml