Hi all,

   I want to play a mp3 file which is stored in the /sdcard/ using
ACTION_VIEW intent and I used following code to accomplish that, but I
got ActivityNotFound Exception..

Intent intent = new Intent(android.content.Intent.ACTION_VIEW);

        Uri data = Uri.parse("file:///sdcard/abc_xyz.mp3");
        intent.setDataAndType(data,"/audio/mp3");

        try {
                  startActivity(intent);
           } catch (ActivityNotFoundException e) {
                  e.printStackTrace();


           }

But I got the following exception,


05-05 15:44:40.563: WARN/System.err(5253):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { action=android.intent.action.VIEW data=file:///sdcard/Main
Agar Kahoon.mp3 type=/audio/mp3 }
05-05 15:44:40.582: WARN/System.err(5253):     at
android.app.Instrumentation.checkStartActivityResult
(Instrumentation.java:1471)
05-05 15:44:40.582: WARN/System.err(5253):     at
android.app.Instrumentation.execStartActivity(Instrumentation.java:
1441)
05-05 15:44:40.593: WARN/System.err(5253):     at
android.app.Activity.startActivityForResult(Activity.java:2526)
05-05 15:44:40.602: WARN/System.err(5253):     at
android.app.Activity.startActivity(Activity.java:2570)
05-05 15:44:40.602: WARN/System.err(5253):     at
test.mp3file.MusicTest.onCreate(MusicTest.java:25)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2104)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2157)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.os.Handler.dispatchMessage(Handler.java:88)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.os.Looper.loop(Looper.java:123)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.main(ActivityThread.java:3739)
05-05 15:44:40.612: WARN/System.err(5253):     at
java.lang.reflect.Method.invokeNative(Native Method)
05-05 15:44:40.612: WARN/System.err(5253):     at
java.lang.reflect.Method.invoke(Method.java:515)
05-05 15:44:40.612: WARN/System.err(5253):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
05-05 15:44:40.612: WARN/System.err(5253):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
05-05 15:44:40.612: WARN/System.err(5253):     at
dalvik.system.NativeStart.main(Native Method)


   In fact I used this approach to play file, because I want the
internal music application with Gui buttons on the display  during
playback. Is it possible to call the internal music application when
we play with the MediaPlayer object ??

Please help. Thanks in advance.

Asif

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

Reply via email to