picasso

Picasso image load callback

守給你的承諾、 提交于 2019-11-28 20:05:12
I want to use Picasso to load three consecutive images one on top of each other in a listview. Using the methods Picasso provides makes this easy. However because these images are loading in at different times it causes a flickering effect as the images come in. For example sometimes image 2 appears before image 1, and when image 1 loads it causes an unnatural stutter. It would be better if I could set the listview's visibility to invisible until all the images are available to be shown. However, there is no callback method I could find for Picasso that would signal when an image has been

Android Picasso Configure LruCache Size

不问归期 提交于 2019-11-28 18:00:00
I am using the trending Picasso in my Project, but I have dumped the heap and it looks like this. Now yesterday it gives me 48M for LruCache used in Picasso. How could I specify the size of it? Note: my loaded images are apparently large. If someone came up with fit() or centerCrop() , I've read that those functions reduce image size, right? But sometimes I have to display small images in the ListView in full view. Now, do those functions cache a scaled down image? Jake Wharton By default, Picasso uses 1/7th of the available heap for it's LRU. This is a "happy" fraction that works best on all

How to get a context in a recycler view adapter

房东的猫 提交于 2019-11-28 15:50:47
I'm trying to use picasso library to be able to load url to imageView, but I'm not able to get the context to use the picasso library correctly. public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> { private List<Post> mDataset; // Provide a reference to the views for each data item // Complex data items may need more than one view per item, and // you provide access to all the views for a data item in a view holder public class ViewHolder extends RecyclerView.ViewHolder { // each data item is just a string in this case public TextView txtHeader; public ImageView pub

How to parse JSON Array inside another JSON Array and display the Clicked item

谁都会走 提交于 2019-11-28 12:30:40
问题 hello i have this Json Data a link and i parsing it like that when i click into the image i want to parsing the JsonArray for the image to piccaso in recycler view like this , but i get all image like this picture how i can solve this problem and get just the images for the item which i clicked ??? this is my module : public class AppShowModule { private List<String> Allimage = new ArrayList<String>(); public List<String> getAllimage() { return Allimage;} public void setAllimage(List<String>

Picasso java.lang.IllegalStateException: Method call should not happen from the main thread

左心房为你撑大大i 提交于 2019-11-28 11:57:51
I am attempting to use Picasso to get three Bitmap images from a URL public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab2); Drawable d1 = new BitmapDrawable(Picasso.with(Tab2.this).load(zestimateImg1).get()); } I am getting FATAL EXCEPTION with this code. I suspect it has to do with the fact that this should be done within AsyncTask , but I can't get it to work. If using that is avoidable, I would like to do this without using AsyncTask . How can I get this code to run without crashing? If the best way to do this is with AsyncTask ,

How to retrieve images from cache memory in picasso?

这一生的挚爱 提交于 2019-11-28 11:31:46
I am using picasso library for loading images .In default picasso, It uses internal cache memory for loading images.But as per my app configuration ,i have to use external cache memory(Cache on Disk). so i used this code for Cache on Disk File httpCacheDir = new File(getApplicationContext().getExternalCacheDir(),"http"); long httpCacheSize = 10 * 1024 * 1024; // 10 MiB HttpResponseCache.install(httpCacheDir, httpCacheSize);} Picasso is flexible. So now it caches images in external Sd card.. The caches is stored in sdcard/android/data/packagename/cache/http The caches are stored in ".1" ,".0".

Glide - load single frame from video at specific time?

核能气质少年 提交于 2019-11-28 11:06:34
I'm trying to use Glide to step through frames in a video file (without running into the keyframe seeking issue that Android suffers from). I can do this in Picasso by doing something like: picasso = new Picasso.Builder(MainActivity.this).addRequestHandler(new PicassoVideoFrameRequestHandler()).build(); picasso.load("videoframe://" + Environment.getExternalStorageDirectory().toString() + "/source.mp4#" + frameNumber) .placeholder(drawable) .memoryPolicy(MemoryPolicy.NO_CACHE) .into(imageView); (frameNumber is simply an int which increases by 50000 microseconds each time). I also have a

Android picasso cache images

懵懂的女人 提交于 2019-11-28 08:30:13
问题 In documentation in written that picasso caches images downloaded , but i havent seen an example how to call that image again from cache. Here i first time load the image : Picasso.with(getActivity()) .load(thirdArticle.getImageURL()) .resize(200, 150) .centerCrop() .into(mainThreeArticleImage); Second time when i call same code above it shouldnt get from cache ??? If not, how to call cached images by that url ?? 回答1: Picasso automatically caches the loaded images, So that next time they will

Picasso: out of memory

大兔子大兔子 提交于 2019-11-28 06:18:35
I have a RecyclerView presenting several images using Picasso . After scrolling some time up and down the application runs out of memory with messages like this: E/dalvikvm-heap﹕ Out of memory on a 3053072-byte allocation. I/dalvikvm﹕ "Picasso-/wp-content/uploads/2013/12/DSC_0972Small.jpg" prio=5 tid=19 RUNNABLE I/dalvikvm﹕ | group="main" sCount=0 dsCount=0 obj=0x42822a50 self=0x59898998 I/dalvikvm﹕ | sysTid=25347 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1500612752 I/dalvikvm﹕ | state=R schedstat=( 10373925093 843291977 45448 ) utm=880 stm=157 core=3 I/dalvikvm﹕ at android

Set Cookie for Picasso

旧城冷巷雨未停 提交于 2019-11-28 04:36:43
问题 im trying to set Cookie for picasso connections . i found this for OkHttp: OkHttpClient client = new OkHttpClient(); CookieManager cookieManager = new CookieManager(); cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); client.setCookieHandler(cookieManager); the problem is i dont know where to set this for Picasso . All ideas accepted ! thanks 回答1: You'll want to use OkHttpDownloader to tie the two together: OkHttpClient client = new OkHttpClient(); CookieManager cookieManager = new