want to set the photo in the imageview

Asked

Viewed 72 times

1

I am new in programming and I’m having difficulty setting the photo in imageview, being that already takes photo and saved in the gallery, but is not setting.

public void usarCamera() {

        File diretorio = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        File imagem = new File(diretorio.getPath() + "/" + System.currentTimeMillis() + ".jpg");
        uri  = Uri.fromFile(imagem);

        Intent intentCamera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intentCamera.putExtra(MediaStore.EXTRA_OUTPUT, uri);
        startActivityForResult(intentCamera, CAMERA);
    }


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

               if(resultCode == RESULT_OK && requestCode == GALERIA_IMAGENS){
                Intent novaIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri);
                sendBroadcast(novaIntent);
                caminhoDaImagem = uri.getPath();
            }
        }
  • Does it make a mistake? Look at this reply

1 answer

-1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.