我正在制作一个拍摄照片的程序,然后显示它的缩略图.使用模拟器时一切顺利,丢弃按钮删除照片.但是在真实设备上,相机意图将图像保存在imageUri变量上,第二个命名就像我刚刚打开相机并自己拍照一样.
private static final int CAMERA_PIC_REQUEST = 1337;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.camera);
//start camera
values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, "New Picture");
values.put(MediaStore.Images.Media.DESCRIPTION,"From your Camera");
imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
image = (ImageView) findViewById(R.id.ImageView01);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, CAMERA_PIC_REQUEST);
//save the image buttons
Button save = (Button) findViewById(R.id.Button01);
Button close = (Button) findViewById(R.id.Button02);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if …
Run Code Online (Sandbox Code Playgroud)