Wednesday, April 27, 2011

[android-developers] Error when launching a ringtone.

Hi,
I have an AlertDialog that when it shows it launches a ringtone,
however i have always an exception, here is what i did:
ad.show();
try {
MediaPlayer mt = MediaPlayer.create(context,R.raw.ringtone);
mt.setVolume(5,5);
mt.start();
mt.setLooping(true);
}
catch(Exception e)
{
Log.d("erreur sonnerie","erreur",e);
}

After showing the AlertDialog(ad.show() ) the ringtone is normally
launched.

Here is the Log:

04-27 00:55:07.658: DEBUG/erreur sonnerie(893): erreur
04-27 00:55:07.658: DEBUG/erreur sonnerie(893):
android.content.res.Resources$NotFoundException: File res/raw/ringtone
from drawable resource ID #0x7f050000
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.content.res.Resources.openRawResourceFd(Resources.java:860)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.media.MediaPlayer.create(MediaPlayer.java:662)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
com.sip_communicator.Dialog.répondre(Dialog.java:101)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
com.sip_communicator.IncomingCallReceiver.onReceive(IncomingCallReceiver.java:
28)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.os.Handler.handleCallback(Handler.java:587)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.os.Handler.dispatchMessage(Handler.java:92)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.os.Looper.loop(Looper.java:123)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.app.ActivityThread.main(ActivityThread.java:3683)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
java.lang.reflect.Method.invokeNative(Native Method)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
java.lang.reflect.Method.invoke(Method.java:507)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
dalvik.system.NativeStart.main(Native Method)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): Caused by:
java.io.FileNotFoundException: This file can not be opened as a file
descriptor; it is probably compressed
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.content.res.AssetManager.openNonAssetFdNative(Native Method)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.content.res.AssetManager.openNonAssetFd(AssetManager.java:427)
04-27 00:55:07.658: DEBUG/erreur sonnerie(893): at
android.content.res.Resources.openRawResourceFd(Resources.java:857)


The ringtone is .ogg file .
What could me the problem ?

Thank you very much.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment