How to apply wallpaper from assets using built-in cropper? - java

I want to apply a wallpaper from assets using the default cropper (shown below):
This is usually done by using the WallpaperManager.getCropAndSetWallpaperIntent(ContentUri uri);
However, I can't figure out how the use the images from the assets to do this. The problem is that this method requires Content URI, and all I have from the assets is the "usual" URI: file:///android_asset/...
How can I do this? Is there a workaround to this method?

Related

Android save image internally (java)

in my android app (java) i want to save a bitmap to locale storage and then get the absolute path so another app (flutter app) can also retrieve this image using the absolute path.
what's the best way to do it ?

retrieve the URL images from SQlite

When retrieve the images from Firebase to SQlite it comes as link, so I am trying now to show the images through Picasso as the following:
Picasso.with(context).load(favoritesList.get(position).getFoodImage())
.into(viewHolder.food_image);
but the image not showing. How can I do it?
The first check value of this favoritesList.get(position).getFoodImage(), if not null, paste url to browser and see result. Check your image in xml file and maybe Picasso library error, because in one of my project, Picasso not working but when I using Glide, it's work fine, and i don't understand why :D. BTW you should set placeholder for image.

How to Get Image Path in my App which is Selected from Whats app's Chat?

i have demo application with image view and in this image view i need to set image from which selected from whats app Chat,
Currently i was getting Path of selected image i.e. content://com.whatsapp.provider.media/item/245429
Does any idea to resolve this ?
Thank You in Advance.
There is no image path, as there is no requirement that this Uri point to a file, let alone point to a file that you have direct filesystem access to.
Use an image-loading library (e.g., Glide, Picasso) and provide it the Uri that you get from WhatsApp. Those libraries know how to use ContentResolver and openInputStream() to read in the bytes associated with that content, convert those bytes into a Bitmap using BitmapFactory.decodeStream(), and put the Bitmap into your ImageView.

X3D ImageTexture without URLs

I'm making a project in Java that loads X3D files and it works great with X3D files that don't contain a URL. But the X3D files that I need to use have URLs contained within them. I'm wondering if there's a way that I can use a JPEG within an X3D file without using imageTexture url='"http//:website.com/album/photo.jpg"'. So I was wondering if I could save the JPEG on my laptop and then put it into the X3D file that way? Or is there another way about doing this?
You need to have a reference to the image file inside the X3D file. The reference can be any URI (URL or local path). The correct way of loading an image is by using the ImageTexture element. The other two elements that are able to load an image in an X3D file is VideoTexture and Inline but I would suggest to use ImageTexture. As Marco13 guessed, if you want to use a local image, instead of providing the URL to the image which is stored somewhere on internet you have to provide the local path to the locally stored image file, e.g. ImageTexture { url ["path/to/image.jpeg"] }

Android set image from file

I have a question file. I am reading it and I want set image to ImageView from file. For ex:
img.setImageResource(R.mipmap.+"simdikiSoru.getUlkeAdi()");
but it isn't working.
R.mipmap will refer to resources, not files on the device's filesystem.
The best solution is to use one of the many image-loading libraries available for Android, such as Picasso.
Picasso.with(this).load(...).into(img);
where this is your Activity and ... is a File or Uri pointing to your image.
If you do not wish to use a library, then you can create your own subclass of AsyncTask, use BitmapFactory to load in a Bitmap in the task's doInBackground() method, and then set the Bitmap on the ImageView in onPostExecute().
The images your put into res/drawable are handled by Android. The best way to call upon an image in the folder would be
setImageResource(R.drawable.your_image_name)

Categories

Resources