How to open the image in the gallery by clicking on it through my application?

Asked

Viewed 1,137 times

0

My app has a button that when it is pressed opens the camera, as soon as I take the photo, it is placed in an Imageview on the screen and the image path is saved in my database. I would like to know how to do when I click on the image on the screen, it open in the gallery with the normal size of the image, because in my application it is small. Remember, I have the image path in the database: "/Storage/sdcard/1442199864328.jpg".

Thank you!

1 answer

0


You can create a method by calling the Gallery app using the Intent class. Create an onClick in your Imageview and call the image app from Intent. Example:

public void visualizarImagem(){
imageView.setOnClickListener (new OnClickListener(){
@Override
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri img = Uri.parse("file://" + caminhodafoto);
intent.setDataAndType(img, "imagem/*");
startActivity(intent);}
}
);
}
  • Thank you very much sparkss, it worked.

  • Oops, you’re welcome Yuri.

Browser other questions tagged

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