Android 调用gallery以恢复图像

Android 调用gallery以恢复图像,android,Android,我正在为我的应用程序编写一个代码,我被卡住了,试图找出这个问题 我想通过应用程序调用GALLERY,然后如果用户选择了一幅图像,该图像将带回我的应用程序以进行进一步操作,而不是打开GALLERY 请帮我编码,提前谢谢:)请查看此处以获得答案: 获取SD卡上的图像。Uri将为 android.provider.MediaStore.Images.Media.EXTERNAL\u CONTENT\u URI onActivityResult方法: protected void onActivityR

我正在为我的应用程序编写一个代码,我被卡住了,试图找出这个问题

我想通过应用程序调用
GALLERY
,然后如果用户选择了一幅图像,该图像将带回我的应用程序以进行进一步操作,而不是打开GALLERY


请帮我编码,提前谢谢:)

请查看此处以获得答案:

获取SD卡上的图像。Uri将为

android.provider.MediaStore.Images.Media.EXTERNAL\u CONTENT\u URI

onActivityResult方法:

protected void onActivityResult(int requestCode, int resultCode,
        Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (resultCode == RESULT_OK) {
        Uri photoUri = intent.getData();

        if (photoUri != null) {
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(this
                    .getContentResolver(), photoUri);

                //Now you can upload this bitmap to server or do something else.
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

查看右侧边栏中的相关问题。有一大堆问题可以回答你的问题。
startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT_IMAGE);
protected void onActivityResult(int requestCode, int resultCode,
        Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);

    if (resultCode == RESULT_OK) {
        Uri photoUri = intent.getData();

        if (photoUri != null) {
            try {
                Bitmap bitmap = MediaStore.Images.Media.getBitmap(this
                    .getContentResolver(), photoUri);

                //Now you can upload this bitmap to server or do something else.
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}