小编Ste*_*lla的帖子

如何从android中的画廊中选择图像?

我有一个问题:我有一个功能,可以从画廊中获取图像;但是当我选择图像时,我没有得到它.

public void funzione(View v){
int SELECT_IMAGE=1;
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),SELECT_IMAGE);
Run Code Online (Sandbox Code Playgroud)

我必须通过电子邮件发送此图片,但我现在不知道如何实现这个:

Intent i = new Intent();
i.setType("application/octet-stream"); 
i.setAction(Intent.ACTION_SEND);
i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ "prova@libero.it" });
i.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test subj");
i.putExtra(android.content.Intent.EXTRA_TEXT, "corpo mail test");
startActivity(Intent.createChooser(i, "Send email"));

}
Run Code Online (Sandbox Code Playgroud)

android

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1