相关疑难解决方法(0)

Android:使用EXTRA_STREAM的Intent.ACTION_SEND在htc Hero上选择Gmail应用时不会附加任何图像

在具有默认邮件应用程序的模拟器上一切正常.但是当我收到一封我使用Gmail应用程序从我的Hero发送的邮件时,我没有依恋.英雄的默认邮件应用程序正常工作.

如何使此代码适用于Hero上的Gmail应用?
你可以看到下面的代码.

    private void startSendIntent() {
        Bitmap bitmap = Bitmap.createBitmap(editableImageView.getWidth(), editableImageView.getHeight(), Bitmap.Config.RGB_565);
        editableImageView.draw(new Canvas(bitmap));
        File png = getFileStreamPath(getString(R.string.file_name));
        FileOutputStream out = null;
        try {
            out = openFileOutput(getString(R.string.file_name), MODE_WORLD_READABLE);
            bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (out != null) out.close();
            }
            catch (IOException ignore) {}
        }
        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(png));
        emailIntent.setType("image/png");
        startActivity(Intent.createChooser(emailIntent, getString(R.string.send_intent_name)));
}
Run Code Online (Sandbox Code Playgroud)

在日志中我看到以下内容:

02-05 17:03:37.526: DEBUG/Gmail(11511): URI FOUND:file:///sdcard/DCIM/100MEDIA/IMAG0001.jpg
02-05 17:03:37.535: DEBUG/Gmail(11511): ComposeActivity added to message:0 …
Run Code Online (Sandbox Code Playgroud)

email android attachment htc-hero android-intent

12
推荐指数
2
解决办法
4万
查看次数

标签 统计

android ×1

android-intent ×1

attachment ×1

email ×1

htc-hero ×1