Where is the root path from the perspective of an Android app? - android

The page on Picasso shows an example usage of its library
Picasso.with(context).load(new File("/images/oprah_bees.gif")).into(imageView2);
I suppose images is not actually in the root folder of the device, maybe the assets folder of the app?

I suppose images is not actually in the root folder of the device
According to that File object, that is exactly where it is. This is... unrealistic.

Related

Android finding source image files on the android device inside the app assets or resources

So, I am trying to place an image in a layout programmatically and I can do this, but only using the mipmap resources. I want to place the full image onto the layout. The answers I have come across mention bitmaps and file paths. What I am confused about is the file path part. Does this mean a file path on the computers source files, or does it mean a file path on the android device in which case, how can I find the image when it is part of the apps resources, not in gallery or to be taken from the camera. If i create a new directory in the project, I can't use R.XXX to find it as it is not there. Under Android the directory does not show up either and dragging an image to the directories under Android does nothing either.
You should put images in res/drawable folder

Get current wallpaper absolute path?

How do we get a current wallpaper absolute path
On Android 4.2 the wallpaper is located at:
/data/system/users/0/wallpaper
Replace the 0 with your user id (take a look in /data/system/users).
Make sure you are looking in the phone's root directory to start, NOT on the SDcard. Once you get to the right subdirectory the wallpaper file will just be called "wallpaper" and until you copy it to the SDcard and rename it to "YourName.jpg" the picture viewers may not recognize it as an image file.
I tried both ES File Explorer and Root Explorer (download from Marketplace) to copy the file from the phone root area., i.e. phone ROOT/data/data/com.android.settings/files/wallpaper...it's the lowest level of the phone storage itself, similar to "computer" in windows.
Probably the File Explorer on your phone won't let you access the root (your phone shouldn't need ROOT privileges just to copy the file)
use wallpaperManager and call getWallpaperInfo. This will return you a wallpaperinfo object which contains all the info about the wallpaper. Read more about the wallpapernfo here.
I would imagine that the current wallpaper will be stored in a private system folder.
On Android Oreo and using one of the provided wallpapers from the system, the wallpaper I wanted wasn't on the path mentioned by the accepted answer but I found the apk that had it on a system folder.
I got it from the path: system/framework/framework-res.apk
I had to open the apk and extract: /res/drawable-nodpi-v4/default_wallpaper.png.
Android Oreo is not in the place from other comments
Internal Storage/Android/data/com.android.systemui/files/backupwallpapers
I just had to find a wallpaper that I deleted from my downloads folder.
Download the apk file ...
go to this path...you can find it here
Download\com.amber.launcher.skin.samsung.galaxy_2018-08-24\res\drawable-nodpi-v4\bg_wallpaper.jpg

How to download a image to a drawable folder from a url?

I would like to add a image to a xml image view, and needs to be updated on timely basis.Whether is there a possibilty of updating directly to the drawables or how to do it from device memory i.e. downloading & calling from internal memory to the xml imageview.Kindly help me with an example or a snippet.Thank you.
Not possible. You will have to save image either to the SD CARD or the
data/data/package folder. You can not write/save image in drawable/res. Sorry.
You cannot update drawable folder.Only thing you can do is save the image in sdcard or in application memory ie /data/data//image.png.To set the image dynamically you can get reference of your image in your activity using findviewbyid and then set its image wherever required.
Research a bit before you ask a question...
During runtime you do not have access to your projects folders, as they are compiled to .apk file and that file runs on the device, now how on earth can you modify those folders while your app is running?
Try downloading it to your SD card or internal memory instead...

android: how to hide folder from appearing in the Gallery

I have an application that creates a folder in the sd-card. After that, I do several operations which may result in storing different media files, graphics in my folder. The problem is that this folder is then visible in the Gallery section which is not appropriate. How can I hide the folder or the contents of my folder from appearing in the Gallery?
Looking forward for a response
Thanks
Put a file named .nomedia in the folder. This can be a zero-byte file if you want -- the name is what matters.
Go to My Files folder, then Pictures or create a folder and name it whatever you want. Go the newly created folder, add another folder again and name it .nomedia. Copy or move photos in the folder (not the .nomedia coz it won't show after creating it). Then you check in the gallery, and voila! Folder isn't shown!
PS: The pictures you have copied/moved can be viewed only in My Files folder, which is much safer.. ;)
PPS: This works on my samsung galaxy win.
Hope I had helped a little
Thanks.
You will start the name of the folder with a period (.). Example:
.asdhsj
Just start the folder name with period (.), it can be any name, but needs to start with period. After that the folder and it's files don't appear in gallery anymore :)
For people who are on android version 5.1.1 some of you cant do this but what you can do is change the extention of that file, for example image.png change ".png" to something like ".txt" or something that way it doesnt show up in your gallery
Happily album covers has a solution.
Here is the solution ;
Rename all album cover picture files to albumart.jpg
My detailed answer can be found here Stop images on sd card from showing up in gallery?

Accessing image files + file browsing in Android

I'm using HTC Dream and trying to read the images stored in the "default" album folder of this phone. But I've yet to found out what's the folder path to those images file.
When I mount the phone to my comp, some of the default images are in:
/E0FD-1813/DCIM/
and the photos taken using the phone are stored in
/E0FD-1813/DCIM/100MEDIA/
But using those paths, accessing the images throws a "No Such File" error.
So
do you know what's the path to that image folder? What would be the path patterns (if any) in other Android phones?
I don't need to set any additional permission to access those files, do I?
Do you know how I can build a "file browsing" widget in my activity? I've searched and seems like there is no such widget and I've to install app that does file browsing. In any case, how to incorporate that as a file-browsing view in my current activity?
Thanks for your kind advice!
But I've yet to found out what's the folder path to those images file.
There is no single folder.
do you know what's the path to that image folder?
There is no single folder. Use the MediaStore content provider.

Categories

Resources