Android Gmail应用无法附加我的CSV文件

时间:2011-04-15 21:49:54

标签: java android

当我将csv文件附加到android上的默认电子邮件应用程序时,以下代码有效,但是当我将同一文件附加到gmail应用程序时,该代码无法正常工作。有没有人有解决gmail问题的方法?

Resources res = getResources();         
        FileOutputStream outPut;

        try {
            outPut = getApplicationContext().openFileOutput("IPAddressPlanner.csv", Context.MODE_WORLD_READABLE);

            SendMail.createCSVAttachment(outPut, res, values_subnet, values_mask, values_inverse, values_subnet_size, values_host_range, values_broadcast);

            File F = getApplicationContext().getFileStreamPath("IPAddressPlanner.csv");
            Uri U = Uri.fromFile(F);

            Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("message/rfc822"); // use from live device
            i.putExtra(Intent.EXTRA_SUBJECT, "IPV4 Address Information");
            i.putExtra(Intent.EXTRA_STREAM, U);
            startActivity(Intent.createChooser(i,"Select email application."));

        } catch (FileNotFoundException e) {
            Log.e(TAG, e.getMessage());
        }

0 个答案:

没有答案