Is there any good way to save image into gallary using File object?
I want to do like this
File file = new File("path to image gallery","empty.jpg");
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").save(file);
I believe JakeWharton meant that ??
picasso issue
Related
i am using Picasso for load image from web and local storage
for load image from web
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
and for load image from storage i add file:// before path for load image
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
but when file path have utf-8 charchter with file name its not load the image like file:///android_asset/۲۰۱٧.png
any idea how to solve it every time i want to use picaso its must string path not Uri or File because its saved in sqlite as string
Try this code:
String url = "file:///android_asset/۲۰۱٧.png";
URLEncoder.encode(url, "UTF-8");
Picasso.with(context).load(url).into(imageView2);
try doing
URIUtil.encodeQuery(url)
see the issue at:
https://github.com/square/picasso/issues/652
I am trying to load an image with UniversalImageLoader. I tried this way:
String path = "/storage/emulated/0/BlackHole/Black Hole/1gatopan0000.png"
ImageLoader.getInstance().displayImage(path, viewHolder.imageView);
But nothing happened. Is it possible to load the image using UniversalImageLoader with the path of the image as a string?
Firstly, you have to add a backslash before any space character in your path.
String path = "/storage/emulated/0/BlackHole/Black\ Hole/1gatopan0000.png"
Then, Picasso is a great library that allows you to load images easily. I personally find it prettier than the UIL. In order to load an image into your ImageView, you simply have to :
Picasso.with(context).load("/your/path/here").into(yourImageView);
Try this:
String path = "/storage/emulated/0/BlackHole/Black\ Hole/1gatopan0000.png"
This LazyLoading library helps me to load the images from the internet. Can i use this library to load the images from the gallery.
imageLoader.DisplayImage(url, image);
What should i send the argurment to display the image from the gallery
Note I'm having the path of the images in the ArrayList
Imp Note : I'm also having the ArrayList of byteArray (one byte array resembles to one image). So then how can i use the library
Edit I encrypted some images from the gallery and stored in SDCard and i need to display the encrypted images in my app(I know the path of the encrypted images) Encryption is done in Byte[] level.
Please suggest me. ThankYou
Can i use this library to load the images from the gallery?
Gallery itself a application which is showing images from your local folder. So if you have a local image you can show it by its path in your App.
You just need to add file in your image path to make path as URI.
Like
String URL = "file:///mnt/sdcard/image.png"; // from SD card
i need to load images from the Sd card into gridview.
For efficiency i'm using Picasso Library
Picasso.with(activity).load(images.get(position).getDataPath())
.resize(96, 96).centerCrop().into(viewHolder.image);
I used the following code in the adapter. unfortunately m unable to see any images
so please can any one help.
Note
And also can anyone suggest any efficient image loading library to load the images from the sd card.
Requirement
I dont to load the image every time when scrolling. If it is already loaded dont load the image on scrolling
To load the file you need to convert it to a uri first
Uri uri = Uri.fromFile(new File(images.get(position).getDataPath()));
Picasso.with(activity).load(uri)
.resize(96, 96).centerCrop().into(viewHolder.image);
Requirement I dont to load the image every time when scrolling. If it
is already loaded dont load the image on scrolling
Picasso is excellent for this
In Picasso version 2.5.2, you need to pass a File as argument to load method, so the image can be loaded as:
Picasso.with(context).load(new File(images.get(position).getDataPath()))
.resize(96, 96).centerCrop().into(viewHolder.image);
I didn't want to create a new File because if the path was already obtained from an existing file, there is no need for a new object (want to see the already existing picture in the device).
According to Picasso docs you have to do something like this:
file:///android_asset/DvpvklR.png
So I used to have:
/storage/sdcard/Pictures/findyoursport/yoursport_1482358052384.jpeg
Prepending: file:// did the trick
So I've got my image gallery project all set up with images saved online and not within the application. It works great. But what I want to do is get the facility to set the image as a wallpaper.
I've got the image to download and save in the external storage as packagename.jpg
Everywhere I've searched for examples on how to set the wallpaper all seem to be based on the image being within the application.
Anyone have any pointers on how to use wallpapermanger to set an image from external storage as the wallpaper?
You need to first retrieve the file from the SDCard and decode the image into a Bitmap using BitmapFactory then you can set the bitmap using WallpaperManager's setBitmap() method.
File file = new File(Environment.getExternalStorageDirectory(), "/directory/yourimage.jpg");
WallpaperManager wallpaperManager = WallpaperManager.getInstance(getBaseContext());
Bitmap myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
wallpaperManager.setBitmap(myBitmap);