Reputation: 6624
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?
Upvotes: 3
Views: 10879
Reputation: 14585
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
Upvotes: 1
Reputation: 24820
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);
Upvotes: 3