如何在android上的邮件中显示图像

时间:2011-08-01 07:14:46

标签: android android-image

在我的Android应用程序中,我需要进行屏幕捕获并在邮件中共享捕获的屏幕(捕获的屏幕显示邮件)。

我通过以下代码进行了屏幕截图:

view = (LinearLayout)findViewById(R.id.screen);
......... 

View v1 = view.getRootView();

System.out.println("Root View : "+v1);

v1.setDrawingCacheEnabled(true);

Bitmap bm = v1.getDrawingCache();

System.out.println("Bitmap : "+bm);

iv.setImageBitmap(bm);

这会缩短屏幕并在ImageView中显示图像。我不知道如何在邮件中显示屏幕截图以及存储图像的位置。请帮我。

Log cat:我得到以下

08-01 12:40:40.640:INFO / System.out(3115):位图:android.graphics.Bitmap@44f0c508

1 个答案:

答案 0 :(得分:0)

Intent emailIntent = new Intent(Intent.ACTION_SEND);
Uri U=Uri.parse("file:///sdcard/logo.png");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,"sivafarshore@yahoo.com");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is email's message");
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,U);
startActivity(Intent.createChooser(emailIntent, "Email:"));