I am trying to display a image captured from camera inside imageview in android
Selecting a photo from the correct gallery works
But the camera fails: "app has stopped"
images.get(2).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    current_image = 2;
                    if (!fill_images[current_image]) {
                        show_dialog();
                    }else {
                        show_delete_dialog();
                    };
                }
            });
 public void show_dialog() {        
                     final ArrayList<String> list = new ArrayList<String>();
                     list.add("select from gallery");
                     list.add("take a photo");
                     AlertDialog.Builder builder = new AlertDialog.Builder(NewAdActivity.this);
                     builder.setAdapter(new ArrayAdapter<String>(NewAdActivity.this, R.layout.row, R.id.mytext, list)
                             , new DialogInterface.OnClickListener() {
                                 @Override
                                 public void onClick(DialogInterface dialogInterface, int i) {
            if (i == 0) {//gallery                           Intent gallery_intent=new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI) ;               startActivityForResult(Intent.createChooser(gallery_intent,"select image"),2);
                                     }
 else if (i == 1){//camera
          Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      File file=new File(Environment.getExternalStorageDirectory(),"file"+String.valueOf(System.currentTimeMillis()+".jpg"));
              uri= Uri.fromFile(file);
            camera_intent.putExtra(MediaStore.EXTRA_OUTPUT,uri);
             camera_intent.putExtra("return-data",true);
         startActivityForResult(camera_intent,1); 
                                     }
                                 }
                             });
                     builder.show();
                 }
 
     
     
     
    