Skip to content Skip to sidebar Skip to footer

How Do I Display The Compressed Image In Imageview And Display Its Size?

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ContentResolver resolver = getContentResolver(); ContentValues contentValues = new ContentV

Solution 1:

Add an ImageView in the xml layout of your Activity. Like this:

<ImageView
     android:id="@+id/my_image_view"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />

Then in your activity's create method you get a reference to that ImageView. Like this:

ImageViewmyImageView= findViewById(R.id.my_image_view);

And now you call "setImageBitmap" on your imageView with your bitmap as an argument. Like this:

myImageView.setImageBitmap(bitmap); //"bitmap" is your bitmap

If I understood you correctly this should be what you want to do

Solution 2:

 InputStream is = getContentResolver().openInputStream(imageUri);
            Bitmap bitmap1 = BitmapFactory.decodeStream(is);
            compImage.setImageBitmap(bitmap1);

Okay....I was managed to set image in Imageview(I hope its Compressed image) Now how do I get the size of this?

Post a Comment for "How Do I Display The Compressed Image In Imageview And Display Its Size?"