当我单击按钮时,程序会询问我要使用哪个文件管理器(或Dropbox等)。然后,我选择例如.mp3文件。当我需要它时,如何告诉我的程序启动此.mp3?如何记住这个选择的文件?
ring_button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent_for_ring_button = new Intent();
intent_for_ring_button.setAction(Intent.ACTION_GET_CONTENT);
File file = new File(REPORTS_DIRECTORY);
intent_for_ring_button.setDataAndType(Uri.fromFile(file),"application/file");
startActivityForResult(Intent.createChooser(intent_for_ring_button,"Open folder"), 0);
}
});
最佳答案
试试这个
Uri myUri = Uri.parse(entry.getFile());
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(myUri, "audio/*");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
关于android - 资源管理器在我的应用中使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32923927/