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. How to implement a listiew like Android built-in application Settings.apk

I want to design a ui like that of Settings > Display (Comments, here Settings 
is an Android built-in applicatin).

That ui looks like a ListView, is it predefined or customized? If it is a 
customized ListView, where can I find the down-arraw icon on the riht of 
Brightness item row?

Thanks.
-Jiang



      

-- 

2. How/where to find key used for signing the system.img applications.

The problem is i want to access email db from my application, but when
im accessing it im getting permission denial exception. Since email is
a system.img application and the permission set for it is
"signatureOrSystem".
So i need to sign my application with the same key. So the question is
where could i find the key in the frameworkcode.

Thanks in advance.

-- 

3. Alternative keyboard

4. Oot congrazt om hoesin

5. Developing HTC touchflo like inteface for android

6. ContactContracts

7. PictBridge support on Android