Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Image in full screen android

I have an image in thumbnail in my application and I want to display full screen image like it shows, when you click on any image in gallery and it displays in full screen.

How can i achieve that?

like image 668
sajjoo Avatar asked Dec 05 '25 13:12

sajjoo


2 Answers

You could launch the gallery app itself to view the image using below code snippet You could give this a try.

Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(file.getAbsolutePath()),"image/*");

startActivity(intent);

like image 191
nandeesh Avatar answered Dec 07 '25 21:12

nandeesh


I would suggest in onClick method of your thumbnail, you can start a new Activity in fullscreen mode:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

and pass the image uri or something which indicate the image source to the new activity :

Intent intent = new Intent(YouActivity.this, FullImage.class);
intent.putExtra("imageUri", R.drawable.yourImage); // or the path to your image : "/sdcard/MyImages/image.png"

and than just show it in imageView of FullImage Activity like this :

ImageView icon = (ImageView) findViewById(R.id.myImage);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inTempStorage = new byte[3*1024];

Bitmap ops = BitmapFactory.decodeFile(path, options);
icon.setImageBitmap(ops);  // where icon is the imageView in your xml file
like image 37
Android-Droid Avatar answered Dec 07 '25 20:12

Android-Droid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!