Open Image in full screen android

10,733

Solution 1

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);

Solution 2

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
Share:
10,733
sajjoo
Author by

sajjoo

Updated on June 04, 2022

Comments

  • sajjoo
    sajjoo almost 2 years

    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?