I am successfully upload my image to firebase but how can show every image in the firm of card view and make it clickable to open activity
You can place an ImageView inside cardview and use Glide library to fetch the image from firebase. Below is the code snippet
String imgUrl = "url to image in firebase";
ImageView iView = (ImageView) view.findViewById(R.id.imageView);
Glide.with(mContext).load(imgUrl)
.thumbnail(0.5f)
.crossFade()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(iView);
There might be other ways but i used this and its fast and simple. Hope it will help you. Thank you.
Related
I am trying to load the image in polygon ImageView using glide library here is the code
GlideApp.with(Activity.this)
.load(path)
.placeholder(R.drawable.user_avatar)
.into(polygonImageView);
When i using this code result is in below image (the image is cut from right and bottom)
But i want this as result
For Polygon ImageView using third party library Click Here to Check Library
Any Help from you will be appreciated.Thanks
I am Refered That PolyGon Imageview Library But Issue was not There.
Just Use This Code It ll be Works Like a Charm
RequestOptions options = new RequestOptions();
options.centerCrop();
Glide.with(this)
.load("your URL")
.apply(options)
.into((ImageView) findViewById(R.id.imageview));
I want show Gif image in Glide library. I write below codes but when show my gif, show very very slow motion . i want show gif normally bit rate not slow motion.
ImageView test = (ImageView) findViewById(R.id.testImageGif);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(test);
Glide.with(this)
.load(R.drawable.login_image)
.into(imageViewTarget);
how can it?
try this
ImageView test = (ImageView) findViewById(R.id.testImageGif);
Glide
.with(this)
.load(R.drawable.login_image)
.asGif()
.into(test);
as #SachinThampan said Here
Xml:
<ImageView
android:id="#+id/title_gif"
android:layout_width="#dimen/gif_width"
android:layout_height="#dimen/gif_height"
/>
Java:
ImageView imageView = (ImageView) findViewById(R.id.title_gif);
Glide.with(this).asGif().load(R.raw.animated_gif).into(imageView);
In build.gradle:
implementation 'com.github.bumptech.glide:glide:4.0.0'
I am trying to display the image in this link: https://dl.dropboxusercontent.com/u/11469423/m6.jpg
in an imageview. i referred to some posts and i did it the following way:
URL url = new URL("https://dl.dropboxusercontent.com/u/11469423/m6.jpg");
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
mIVPic.setImageBitmap(bmp);
but at runtime, the imageview is displayng nothing.
please let me know why the image in the link is not getting displayed on the imageview and how to do it
Take a look at the picasso library
Then you can do things like
Picasso.with(context)
.load("http://i.imgur.com/DvpvklR.png")
.into(imageView);
I have to show load GIF image from drawable to ImageView using glide.I have tried with following.
Glide.with(LoginActivity.this)
.load(getResources().getDrawable(R.drawable.bg_gif)).asGif()
.crossFade()
.into(relativeLayout);
But isn't seem working and it's working when I'm place image in raw folder.but the problem is I have to use different dimension images.
Any help would be greatly appreciated.
You can try to use Ion it works fine for me.
Ion
Using Ion
Ion.with(imgView)
.error(R.drawable.default_image)
.animateGif(AnimateGifMode.ANIMATE)
.load("file:///android_asset/animated.gif");
Using Glide
ImageView imageView = (ImageView) findViewById(R.id.imageView);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView);
Glide.with(this).load(R.raw.sample_gif).into(imageViewTarget);
Another Approach
For Glide 3.0 you need to set asGif() earlier:
Glide.with(context)
.load(imageUrl)
.asGif()
.placeholder(R.drawable.loading2)
.crossFade()
.into(imageView);
Keep in mind that just using load() will load either a GIF or a Bitmap depending on the type of the data. Unless you want your load to fail if the given url is not a gif, you don't need to specify asGif()
Just pass the resource id directly to load():
Glide.with(LoginActivity.this)
.load(R.drawable.bg_gif)
.asGif() // you may not need this
.crossFade()
.into(relativeLayout);
Steps to load Gif images from drawable
You need to move your Gif image tores/raw folder of your project
(
if your project don't have raw folder in resource directly then simply make one and put your gif in it )
and then you can simply load your gif with just one line of code
Glide.with(this)
.load(R.raw.splash)
.into(new GlideDrawableImageViewTarget(
(ImageView) findViewById(R.id.image)));
Place your Gif in the "raw" folder and use
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView);
Glide.with(this).load(R.raw.test).into(imageViewTarget);
For Glide 4
GlideApp.with(this)
.load(R.raw.gif_file)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(imageView);
I have an horizontal scroll views for different categories of images. On click of image thumbnail it will display that image. Now on click of thumbnail need to display the image along with slide view.
How to do this?. Now am able to display single image at once on click of thumbnail. Am using picasso to do this.
please help me out. Am getting the data(image url) as json response from server.
You should use ViewPager for Horizontally showing pictures.
You can use HorizontalScrollView
Every time You can Create New object of ImageView like
ImageView imageView = (ImageView) findViewById(R.id.imageView);
and add that image inside HorizontalScrollView.
and then you can load image like.
Picasso.with(this)
.load("YOUR IMAGE URL HERE")
.placeholder(R.drawable.ic_placeholder) // optional
.error(R.drawable.ic_error_fallback) // optional
.resize(250, 200) // optional
.rotate(90) // optional
.into(imageView);