开发者

what is the issue i am Not able to open the native player to play the recorded file?

开发者 https://www.devze.com 2023-02-26 11:25 出处:网络
This is my code.what i am using? Intent intent = new Intent(Intent.ACTION_DEFAULT); intent.setDataAndType(Uri.parse(fileName), \"audio/*\");

This is my code.what i am using?

Intent intent = new Intent(Intent.ACTION_DEFAULT);
intent.setDataAndType(Uri.parse(fileName), "audio/*");
startActivity(intent);

It is giving error

android.content.ActivityNotFoundException: No Activity found to han开发者_JAVA技巧dle Intent { act=android.intent.action.VIEW dat=/mnt/sdcard/DCIM/Hitesh_2011-04-19Time10-55.amr typ=audio/* }

is there any permission to use native player.what is the issue?

plz help me.plz Thanks in advance.


i dont get what do you mean by native player. but still this is the code that i have used to play a local file in the sdcard using the default player.

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

        Uri data = Uri.parse("file://"+Environment.getExternalStorageDirectory()
                .getAbsolutePath()+"/" + fileName);
        String type = "audio/mp3";
        intent.setDataAndType(data, type);
        startActivity(intent);

Hope it helps and let me know the output of it.

0

精彩评论

暂无评论...
验证码 换一张
取 消