I want to allow user to pick a media player to play my file
here is java snippet
How to use this ?
currently i am using
But this code doesnot opens a popup to choose.And i cannot find setDataAndType method in intent lib.
here is java snippet
B4X:
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));
How to use this ?
currently i am using
B4X:
Dim r As Reflector
Dim f As Object
f = r.CreateObject2("java.io.File", Array As Object("/sdcard/test.amr"), Array As String("java.lang.String"))
Dim share As Intent
share.Initialize(share.ACTION_VIEW,r.RunStaticMethod("android.net.Uri", "fromFile", _
Array As Object(f), Array As String("java.io.File")))
share.WrapAsIntentChooser("Choose")
StartActivity(share)
But this code doesnot opens a popup to choose.And i cannot find setDataAndType method in intent lib.