Android launching music player using intent
I found one way to do this.
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(YOUR_SONG_PATH), "audio/*");
startActivity(intent);
Launching Media Player using Intent
I think the best option is to use a chooser activity, where the user can choose his favorite media player.
Intent viewIntent = new Intent(Intent.ACTION_VIEW);
File file = new File((String) ((TextView) item).getText());
viewIntent.setDataAndType(Uri.fromFile(file), "audio/*");
startActivity(Intent.createChooser(viewIntent, null));
By the way, that way of passing the file name seems a bit weird to me. I would consider changing it.
I am not sure, but you should be able to see your own player in the chooser if you declare the corresponding intent-filters.
Related Topics
Why Do I Get Com.Google.Android.Gms.Common.Api.Apiexception: 10:
Cancel Notification on Remove Application from Multitask Panel
Android Studio Gradle Dsl Method Not Found: 'Android()' -- Error(17,0)
Google Maps API V2 Draw Part of Circle on Mapfragment
Pass Arraylist of User Defined Objects to Intent Android
Android: Background Image Size (In Pixel) Which Support All Devices
Pairing Android and Wear Emulators
How to Use Mapview in Android Using Google Map V2
Android Splash Screen Image Sizes to Fit All Devices
What Is the Intent of the Methods Getitem and Getitemid in the Android Class Baseadapter
Duplicate Files Copied (Android Studio 0.4.0)
What's Wrong with Debugging in Eclipse on Android
Change Actionbar Color Programmatically More Than Once
How to Change the Package Name of an Android App on Google Play