0
这可能是重复的,但是我需要一种方式将图像读回到我正在开发的Android应用程序中。图像被保存到一个名为Venns Road Accident的自定义文件夹中。我已经看过多个来源,但似乎没有任何工作适合我。从Android设备上的文件夹中获取图像以在应用程序中显示
这是捕获和保存图像的代码。
public void Pictures (View v)
{
//Call the camera and get phone date and time
Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
//Create the folder for the images to be saved
File imagesFolder = new File(Environment.getExternalStorageDirectory(), "Venns Road Accident");
imagesFolder.mkdirs();
//Apply the system date and time as the name of the image
File image = new File(imagesFolder, "VCA_" + timeStamp + ".png");
Uri uriSavedImage = Uri.fromFile(image);
//Saving of image and allowing for new image to be captured
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
startActivityForResult(imageIntent, CAMERA_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_REQUEST)
Toast.makeText(Pictures.this, "Image Saved", Toast.LENGTH_LONG).show();
else
Toast.makeText(Pictures.this, "Image not Saved", Toast.LENGTH_LONG).show();
}
更具体地说明实际问题是什么。 – raxelsson
您发布的代码用于捕获图像,而不是用于阅读它们。发布您为编写应用程序阅读/显示图像而编写的代码,并向我们指出错误的位置。 – pleft