好的,所以我有一个具有自定义文件夹的应用程序:
我想打开以下类型:
protected String[] acceptableTypes = {"jpg", "gif", "png", "bmp", "pdf", "txt"};
每当我单击文件时,我都可以使用以下代码打开图像或至少 jgps:
MediaScannerConnection.scanFile(((Activity) getContext()), new String[] { filePath }, null,
new MediaScannerConnection.OnScanCompletedListener() {
@Override public void onScanCompleted(String path, Uri uri) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "image/*");
((Activity) getContext()).startActivityForResult(intent, ConferenceActivity.ACTIVITY_SELECT_IMAGE);
}
});
现在我该如何过滤它以便我可以使用正确的程序打开正确的文件类型?