Glide is not working in my project - android

I am developing an application in which i am using Glide Library to load image from server. But Unfortunately this is not working and i am completely unaware about this and trying to solve this issue since last two days.
this is my code.
Glide.with(this).load(response.getBank_cash_deposit().getData().getAttributes().getAttachment()).into(mSelectedImage);

Try Log your image response. you're getting correct image URL or not.
If the image URL is correct then check whether there is space in your image URL or not.
If the space is exists then replace space in your URL String with %20 with the help of string.replace() function.
String image=response.getBank_cash_deposit().getData().getAttributes().getAttachment();
Log.d("Image",image);
if space exists
then
image.replace(" ","%20");
Also check image url on web.

Related

Store images from url in cache and use them as thumbnail or placeholder like whatsapp.

I am developing story feature app like instagram or whatsapp but I got stuck somewhere. I am getting image thumbnail from server as URL but when I try to use it . It take some time to load that image.So I want to Load add thumbnail images from url in previous activity and then set that thumbnail from cache.How I can store url images in cache Hashmap or arraylist to use them in next activity.Please help.I am in trouble right now.
You can use Glide for catching the image from URL.

Picasso does not load image url reference, but loads "http://...."

Picasso doesnt load images if I use imageURL reference but loads when I use actual url e.g. "http://i2.cdn.turner.com/cnnnext/dam/assets/161017171526-cafe-neo-cup-super-169.jpg"
String imageURL = feedItem.getImageUrl();
Picasso.with(getContext()).load(imageURL).resize(600, 0).into(newsImage);
Log.i(LOG_TAG,"Image url is: "+imageURL);
Here is the log output from above
10-20 22:32:00.141 13274-13274/bw.co.fus.print I/NewsFeedAdapter: Image url is: "http://i2.cdn.turner.com/cnnnext/dam/assets/161017171526-cafe-neo-cup-super-169.jpg"
Picasso loads when I use this
Picasso.with(getContext()).load("http://i2.cdn.turner.com/cnnnext/dam/assets/161017171526-cafe-neo-cup-super-169.jpg").resize(600, 0).into(newsImage);
I have tried different resize options, including .fit() and without, also .centercrop(). Also thought it could be null but clearly its not.
Please double check if your feedItem#imageUrl variable doesn't have quotation marks on either side. According to your log output, it has. If you are passing URI to Picasso as a String, it should look like
http://whatever.com/...
and not
"http://whatever.com/..."
Also, use debugger to find out more about what's inside of your model for this specific time (beware, if you are using Realm, it will shown as null, here's why)

Unable to fetch GPlus profile pic. Is the Google Plus Image fetch URL updated?

It's weird, but till yesterday i was able to get the gplus user's image in my app but today it's just not coming. Nothing simply blank. And just appears at some time..
I have been using the urls specified in Getting Google+ profile picture url with user_id but these all seem invalid and gives 404 Error.
https://plus.google.com/s2/photos/profile/116018066779980863044?sz=100
If anybody could help me out why this weird behaviour. The Profile pic appears seldom. But mostly it's blank.
The image URL you were using was never a public API and so there was no guarantee it would continue to work. The recommended practice going forward is to use the people.get API method to get the profile => image => url value instead. That URL could stop working if the user changes their avatar so you might want to fetch the actual image and cache it on your own servers.
I think the Image url has been updated.
Inorder to get that, we can use the PlusClient objects methods:
imageURL = mPlusClient.getCurrentPerson().getImage().getUrl()
{Returns a String - Image Url as String}
imageURL = mPlusClient.getCurrentPerson().getImage()
{Returns an instance of Image object}

how to get clear image on Facebook Wall

I used graph API Json Response of facebook Wall POst Images and display in my APP i successfully got it. But the images look very Blur .. please tel me how to get clear images as like in Facebook
here is my code
URL url=new URL("http://graph.facebook.com/"+hashMap.get("id")+"/picture?type=normal");
Bitmap bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_ProfilePicture)).setImageBitmap(bitmap);
url=new URL(hashMap.get("picture_url"));
bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap);
And in AsynTask
dobackground(){
hashMap.put("picture_url", data.getJSONObject(i).getString("picture"));
}
Use "/picture?type=large" instead of "/picture?type=normal" to get a slightly bigger picture.
While ?type=large provides a bigger image it may still not be large enough for a xhdpi display. You can actually specify a actual size now and they'll try their best to fulfill it.
For example this gives you a large square of Mark Zuckerberg:
http://graph.facebook.com/4/picture?width=500&height=500

JSOUP to display images in Image view using the URL

How can i use JSOUP to display images in Image view using the URL. Any sample code is available for that. I searched but i couldn't find out.
Please help me with any link.
Thanks.
fir make the connection with provided link then you can get the image with
imagesRec = document.select("img[src~=(?i)\\.(png|jpe?g|gif)]");
then
String imgSrcUrl = img.attr("abs:src"); // imagePath
the you will use the Picasso lib for displaying the url as image in imageView
Picasso.with(MainActivity.this).load(imgSrcUrl).into(logo);
and thats it
you would have to parse the url of the image from the tag and then put into a string or similar. this string you can then use to load your image into an imageView.

Categories

Resources