Android 为什么CVS reader应用程序无法打开我的文件

Android 为什么CVS reader应用程序无法打开我的文件,android,csv,Android,Csv,在我的应用程序中,我将数据写入csv文件,然后我想让用户使用设备可能具有的某个csv阅读器应用程序来查看数据。 打开读卡器应用程序的代码如下: String dataType = "text/csv"; if(!hasCSVReader(dataType)) { Log.i(TAG, "text/csv reader aplication was not found"); dataType = "text/*"; } i.setDataAndType(uri, dataType)

在我的应用程序中,我将数据写入csv文件,然后我想让用户使用设备可能具有的某个csv阅读器应用程序来查看数据。 打开读卡器应用程序的代码如下:

String dataType = "text/csv";
if(!hasCSVReader(dataType)) {
    Log.i(TAG, "text/csv reader aplication was not found");
    dataType = "text/*";
}
i.setDataAndType(uri, dataType);
try {
    startActivity(Intent.createChooser(i, "OMW: Open history file..."));
} catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(this, "No CSV or text reader application installed.", Toast.LENGTH_SHORT).show();
}
//check if dataType reader is installed 
private boolean hasCSVReader(String dataType) {
    PackageManager pm = getPackageManager();
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setType(dataType);
    return (pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY).size() > 0);
}
hasCSVReader(..)如下所示:

String dataType = "text/csv";
if(!hasCSVReader(dataType)) {
    Log.i(TAG, "text/csv reader aplication was not found");
    dataType = "text/*";
}
i.setDataAndType(uri, dataType);
try {
    startActivity(Intent.createChooser(i, "OMW: Open history file..."));
} catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(this, "No CSV or text reader application installed.", Toast.LENGTH_SHORT).show();
}
//check if dataType reader is installed 
private boolean hasCSVReader(String dataType) {
    PackageManager pm = getPackageManager();
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setType(dataType);
    return (pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY).size() > 0);
}
在我的LG设备中,
hasCSVReader(..)
返回false,因此数据类型为
“text/*”
,可从中选择的一个应用程序是“Polaris Viewer 4”,该应用程序可打开csv文件

在三星3设备中,
hasCSVReader(..)
返回true,数据类型为
“text/csv”
,列出的应用程序为“Polaris Viewer 4.1”和“OfficeSuite”,但两者都无法打开文件。 当我将数据类型设置为
“text/*”
时,我得到了更多的应用程序,但没有一个能够打开文件

请注意,使用android file explorer(或其名称)导航到该文件并打开它时,会再次列出Polaris Viewer 4.1和OfficeSuite,但现在这两个浏览器都可以毫无问题地打开该文件


我做错了什么?

如果没有解决方法,作为一种解决方法,我希望使用指定的文件夹打开文件管理器。我该怎么做?