picasso

Is it possible to change the size of the cache Picasso uses for images?

社会主义新天地 提交于 2019-11-30 16:11:16
问题 I'm loading images from URLs (http://) with Picasso. Sometimes when i try to "preload" an image using Picasso's fetch() method, the image doesn't get cached. I guess it's because it's size is too big. Read the answer for this question, but setCache() doesn't seem to be recognized for me, i don't even find it in the Picasso documentation. Is there any way to change the cache size Picasso uses for bitmaps? 回答1: You can do: int maxSize = MAX_CACHE_SIZE; Picasso picasso = new Picasso.Builder

How to add progress bar to Picasso library

做~自己de王妃 提交于 2019-11-30 15:42:22
How can you add a progress bar to Picasso library with this code for downloading photos String Url = "link url"; Picasso.with(G.currentActivity).load(Url).into(imageView); That feature is not available at the moment. However, you can put a progress bar on top of the imageview and attach a call back for when the image is downloaded then hide the progress bar. <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:id="@+id/image" android:layout_width="match_parent" android

Using Picasso with Image Getter

六月ゝ 毕业季﹏ 提交于 2019-11-30 14:55:50
I ma building a chat application and I am attempting to append an image to an EditText, through use of Picasso to get the image from a URL and the append and ImageGetter to attach the image to the EditText. However, what I have implemented below does not work, as appending messages when using the app displays nothing (but the message does show up in the database). I have tested without using Picasso, as simply just using the ImageGetter with an image resource within the app works just fine, only it's not from a URL as is required. What is the proper way to configure the ImageGetter and/or the

How to add authentication token in header in Picasso library

笑着哭i 提交于 2019-11-30 14:18:06
问题 I am using the picasso library to download the bitmap so in the api I need to pass the token in the headers. I tried below code from this thread Android Picasso library, How to add authentication headers? public static Picasso getImageLoader(final Context context) { // fetch the auth value sSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); Picasso.Builder builder = new Picasso.Builder(context); builder.downloader(new OkHttpDownloader(context)

Use of Target in Picasso on Adapter

こ雲淡風輕ζ 提交于 2019-11-30 13:01:01
Im having big troubles using a Target inside an adapter. Im confused about the documentation on the code Objects implementing this class must have a working implementation of {@link #equals(Object)} and {@link #hashCode()} for proper storage internally. Instances of this interface will also be compared to determine if view recycling is occurring. It is recommended that you add this interface directly on to a custom view type when using in an adapter to ensure correct recycling behavior. Im trying to use the Target in this way: class CustomTarget implements Target { private ImageView imageView;

Picasso image loading issue with Android 9.0 Pie

只愿长相守 提交于 2019-11-30 12:32:19
I am not able to load images using Picasso library in Android 9.0 Pie. Actually, it works fine for below versions. It is not showing any error message. Someone has shared his logs on Github using Picasso.get().setLoggingEnabled(true); He has message log: 2018-10-19 13:13:20.467 24840-24862/com.xyz.test.testpicasso D/ViewContentFactory: initViewContentFetcherClass 2018-10-19 13:13:20.467 24840-24862/com.xyz.test.testpicasso I/ContentCatcher: ViewContentFetcher : ViewContentFetcher 2018-10-19 13:13:20.467 24840-24862/com.xyz.test.testpicasso D/ViewContentFactory: createInterceptor took 0ms 2018

How to add authentication token in header in Picasso library

不羁岁月 提交于 2019-11-30 10:09:27
I am using the picasso library to download the bitmap so in the api I need to pass the token in the headers. I tried below code from this thread Android Picasso library, How to add authentication headers? public static Picasso getImageLoader(final Context context) { // fetch the auth value sSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); Picasso.Builder builder = new Picasso.Builder(context); builder.downloader(new OkHttpDownloader(context) { @Override protected HttpURLConnection openConnection(Uri uri) throws IOException { HttpURLConnection

Transparent part of image in ImageView become black

隐身守侯 提交于 2019-11-30 08:24:41
I have problem when displaying image with transparency in Android KitKat (Nexus 7), it is OK in nexus 4 (KitKat) and other previous Android OS, here the image: and ImageView layout: <ImageView android:id="@+id/avatar" android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center_vertical" android:layout_marginLeft="21dp" android:padding="3dp" android:src="@drawable/icon_button_profile_new" android:tag="@string/avatar" /> and here the screenshot when running on Nexus 7 (Android 4.4) also, I use Picasso for download & caching image from the URL. hakim After some trial:

how to add picasso library in android studio

梦想的初衷 提交于 2019-11-30 08:23:29
I am getting this error, please help me. Error:A problem occurred configuring project ':app'. > Cannot evaluate module picasso-master : Configuration with name 'default' not found. Done so far : 1. download the picaso 2.unzip the zip folder 3.Under project section created one directory called as lib and add the unzip file 4. In settings-gradle include ':app' include ':libs:picasso-master' wrote these lines. 5. after that in project structure module dependency add the picasso library 6. rebuild and clean 7. dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android

How Picasso Actually Cache the Images

南楼画角 提交于 2019-11-30 05:13:45
I would like to know how exactly Picasso Library is caching the images inside the application. I know it used HttpHeaders to check weather to fetch images from network. But, is there any time frame it is caching the images ? Like invaliding the cache after a day or something ? The problem is my project is loading huge number of small images from network. Some times, the new images got reflected in next launch. But, some times, it doesn't. The worst part is, some images got reflected the changes while others are not even though the changes are made at the same time. But, when I uninstall the