I want play audio file, which is on sdcard, with intent
String path = Environment.getExternalStorageDirectory
().getAbsolutePath
();
File audioFile = new File(path, "westron.mp3");
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(audioFile);
intent.setData(uri);
intent.seType("audio/*");
try{
if (uri != null) {
startActivity(intent);
}
}catch(Exception e){}
When the media file is in content provider it is working fine, the
following code works good, it launches androids audio players for this
intent
Note : for this media is recorded using Intent intent = new Intent
(Media.RECORD_SOUND_ACTION);
startActivityForResult(intent, RECORD);
while file on sdcard is recorded using audio API s
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = getVoiceUri(getIntent().getDataString());
intent.setData(uri);
Log.v(TAG, "play " + uri);
if (uri != null) {
startActivity(intent);
}
Plz guide is it possible to launch intent for playing audio file which
on sdcard
Thank you
Jagtap
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---