当与捕获的图像相关的代码运行时,冻结我的模拟器?

时间:2013-03-31 13:48:28

标签: android file android-intent android-emulator

 imgbtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {  
            String path = getDir("camerApp", Context.MODE_PRIVATE).getPath() +            "/test.jpg";
             File file = new File(path);
            final Uri outputFileUri = Uri.fromFile(file);
             Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
             startActivityForResult(cameraIntent, CAMERA_REQUEST); 
        }
    });

 protected void onActivityResult(int requestCode, int resultCode, Intent data) {  

        if(requestCode == CAMERA_REQUEST) {  
            Bitmap photo = (Bitmap) data.getExtras().get(MediaStore.EXTRA_OUTPUT);
            imageView.setImageBitmap(photo);
        if (resultCode == RESULT_OK) {
            // Image captured and saved to fileUri specified in the Intent
            Toast.makeText(this, "Image saved to:\n" +
                     data.getData(), Toast.LENGTH_LONG).show();
        } else if (resultCode == RESULT_CANCELED) {
            // User cancelled the image capture
            Toast.makeText(this, "Image saved to:\n" +
                    data.getData(), Toast.LENGTH_LONG).show();
        } } 

这些是我的代码中的部分,但是当捕获图片并单击确定,然后模拟器冻结并且没有执行任何操作。

0 个答案:

没有答案