进度条android aac播放器问题

时间:2013-03-11 05:17:06

标签: android

嗨我试图从我在Android中的aacplayer获取进度条我已经有了这段代码:

public void playerPCMFeedBuffer(boolean isPlaying, final int bufSizeMs, final int bufCapacityMs) {
    float percent = bufSizeMs * 100 / bufCapacityMs;
    System.out.println("Buffer = " + percent + "% , "+bufSizeMs+" / "+bufCapacityMs);

    handler.post(new Runnable() {
        public void run() {
            progress.setProgress(bufSizeMs * 100 / bufCapacityMs);

        }
    });

这给了我音频流的缓冲区,所以我想我可以设置进度条并显示进度条自动移动。但我得到这个错误:

03-11 00:15:15.885: E/AndroidRuntime(7609): FATAL EXCEPTION: main
03-11 00:15:15.885: E/AndroidRuntime(7609): java.lang.NullPointerException
03-11 00:15:15.885: E/AndroidRuntime(7609):     at com.webcraftbd.radio.RadioService$1$1.run(RadioService.java:712)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at android.os.Handler.handleCallback(Handler.java:615)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at android.os.Looper.loop(Looper.java:137)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at android.app.ActivityThread.main(ActivityThread.java:4898)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at java.lang.reflect.Method.invokeNative(Native Method)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at java.lang.reflect.Method.invoke(Method.java:511)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
03-11 00:15:15.885: E/AndroidRuntime(7609):     at dalvik.system.NativeStart.main(Native Method)
非常感谢你。

1 个答案:

答案 0 :(得分:0)

System.out.println()在android开发中无效。使用

  Log.d("tag", "message"); 

代替