如何设置默认打开(对话框)选项到我的Android应用程序?

时间:2016-03-01 06:15:56

标签: android default android-alertdialog open-with

我的设备中有一个名为test.csv的文件。当我点击那个文件是通过我的app.how打开来设置默认打开(对话框)选项到我在Android的应用程序?

enter image description here

上面是将我的应用程序添加到对话框列表的示例dailog.how?

1 个答案:

答案 0 :(得分:-1)

我想您可能想要阅读csv文件。你可以得到csv文件路径。请参阅以下内容。

public static void readCSV(File file) {
    BufferedReader reader = null;
    StringBuilder stringBuilder = new StringBuilder();
    try {
        InputStreamReader isr = new InputStreamReader(new FileInputStream(file));// your csv file
        reader = new BufferedReader(isr);
        String line = null; // every time read one line
        while ((line = reader.readLine()) != null) {
            stringBuilder.append(line);
            stringBuilder.append("\n");
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
 }

stringBuilder.toString()是你的csv文件的内容。抱歉我的英文。