曲の再生中 (ダウンロード後) で例外が発生しmplayer.setDataSource(fis.getFD());
ます。ここで例外が発生するのはなぜですか?
while (isDownloading)
{
try
{
String filePath = PATH + sponser;
FileInputStream fis = new FileInputStream(filePath);
mplayer.setDataSource(fis.getFD() );
mplayer.setOnPreparedListener(new OnPreparedListener()
{
@Override
public void onPrepared(MediaPlayer mp) {
}
});
mplayer.prepare();
mplayer.start();
mplayer.setOnCompletionListener(new OnCompletionListener()
{
@Override
public void onCompletion(MediaPlayer mp)
{
}
});
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
isDownloading = false;
}
}
ログキャット:
03-07 17:20:14.400: W/System.err(3942): java.lang.NullPointerException
03-07 17:20:14.400: W/System.err(3942): at com.nelitemusic.MyMixes$CustomAdapter$1.onClick(MyMixes.java:399)
03-07 17:20:14.410: W/System.err(3942): at android.view.View.performClick(View.java:3127)
03-07 17:20:14.410: W/System.err(3942): at android.view.View$PerformClick.run(View.java:12025)
03-07 17:20:14.410: W/System.err(3942): at android.os.Handler.handleCallback(Handler.java:587)
03-07 17:20:14.410: W/System.err(3942): at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 17:20:14.420: W/System.err(3942): at android.os.Looper.loop(Looper.java:132)
03-07 17:20:14.420: W/System.err(3942): at android.app.ActivityThread.main(ActivityThread.java:4126)
03-07 17:20:14.420: W/System.err(3942): at java.lang.reflect.Method.invokeNative(Native Method)
03-07 17:20:14.420: W/System.err(3942): at java.lang.reflect.Method.invoke(Method.java:491)
03-07 17:20:14.420: W/System.err(3942): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
03-07 17:20:14.420: W/System.err(3942): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
03-07 17:20:14.420: W/System.err(3942): at dalvik.system.NativeStart.main(Native Method)