How to connect XML to resource folders - java

Alright so I have been reading Android's tutorial on how to support multiple screen sizes (https://developer.android.com/training/multiscreen/screensizes.html#TaskUseSWQuali) and I do not know what they are doing, I have gotten as far as to make multiple folders like "sw600dp" (http://imgur.com/a/PeTHW), but I do not know how to connect the XMLs to the right folder does anyone know how?! Thanks

You will see folder like "values-w820p" and many more in your project's resources folder. These are the folders that are specific to a particular screen resolution.
So for instance you put a image in the folder values-820p, when the use runs your app on such resolution device. This folder of your app will be automatically be accessed.
In short you can create folders for specific resolutions and then put images for that that resolution in these folders.

Related

Creating a storage for images directly in tomcat folder (Java)

I searched around the web and here and couldn't find a conclusive answer to this rather simple question. I am using Java+MySQL+HTML and CSS.
I created a webapp, and in this webapp the user can upload the photos path to the database .At the same time I am creating a folder completely outside of tomcat to copy inserted images there. The folder is on my desktop as I am on localhost, but I want to make the storage on the server not on my desktop.
After checking stackoverflow I saw that it is bad to store photos/images in tomcats webapp/AppName folder because this will overwrite the images all the time at redeployment which I don't want to do.
My tomcat folder is on desktop. Can I create a folder to store the images for this specific app here:
\Desktop\ApacheTomcat\apache-tomcat-9.0.24\ ?
The folder would be called TripAppImages like \Desktop\ApacheTomcat\apache-tomcat-9.0.24\TripAppImages and will be besides all of tomcats other folders like bin, conf, etc. I will also use this folder to display the images that the user inserted , back to him in a html page.
EDIT: ok so I have finally come upon a message from here how to create a folder in tomcat webserver using java program? from BalusC which says:
"Please note that you shouldn't store the files in the expanded WAR folder, or they will get lost every time you redeploy the webapp. Store them on a fixed path outside Tomcat's /webapps folder."
This I believe means that I can store the images like this \Desktop\ApacheTomcat\apache-tomcat-9.0.24\TripAppImages. As long ass they are not in the webapp folder it means they won't be overwritten.
The only folders you should avoid are temp, webapp, work and its subfolders, because yes, those folders can have its content replaced or deleted during deploys and cleanings, every other folder inside tomcat can be considered as 'just a folder' that, if you don't modify its contents, you can use the way you want. Of course it would not be normal or standard to, for example, store videos inside Tomcat\bin but if you don't touch the original files there you can do it.
So technically speaking, you can create a folder like \Desktop\ApacheTomcat\apache-tomcat-9.0.24\icecream and put images there it will not be erased or replaced by a deploy.
If it is just for you, temporary or not production, just avoid the three folders mentioned at the beginning and you are good to go.

Folder view in ANDROID STUDIO

I want to go to a certain folder in the application I wrote in android studio.I want to go where my folders are.I want to go back to where the folders are in not accessing the data in it. for example "my files - internal storage - downloads". I want to open it. Would you suggest a source way or function, which I can use for this? Thank you.
try device file explorer https://developer.android.com/studio/debug/device-file-explorer
hope this helps

Prevent Google Photos to ask for backing up app folders

I am making a chat app that stores sent images in it's private folder on external storage. After saving an image the Google Photos app notices that and asks if the user wants to backup that folder.
Is there a way to prevent that?
'.nomedia' file does not help.
Kindof, Google backup reads imgs and video types.
There are 3 workarounds that I know,
Make the Folder hidden.
Add "." before the folder name. (when u create the folder)
Have a lot of folder hierarchy.
Example: /0/AppName/sentimgs/ <- Can be read by google backup
/0/AppName/bla/bla/bla/sentimgs/ <- Cant be read.
Save the img without an extension. And make ur app add it when they want to view it.
The Shank's first solution worked for me.
However, I noticed that I created .nomedia file wrong, so after fixing it the backup problem has been also solved.

Android access file system nexus 7

Background
I am developing an android application that will only be used on Nexus 7 tablets (my team is also providing and has access to the hardware).
Problem
The app needs to be flexible to allow content to be added (by non-tech savvy users) to the app and accessed without an internet connection.
Our Idea
Android devices have a file system. We want to design a file system layout such that the people adding content to the application can drag and drop into the correct folder.
e.g.
AppName
Images
Videos
If the user adds a video to the videos folder of the device under our app, it will show up in the app.
We understand that this could easily go wrong (accidentally delete a folder, etc.) but this is out best attempt to solve this without having to update the app ourselves whenever new content comes up (and remember, no internet connection!).
The Question
Is it possible to access the android file system contents and insert them into an app as described in the "Our Idea" section? If so, how?
Yes. This is possible if you don't bother about content security. You can copy the content to any of the file system path in sdcard and your app can look for the folder and read the files .
Example , you can create a folder in sdcard as
sdcard/appname/media/
and create a layout to access the files in the device, and when user selects the files provide option to copy it to your sdcard/appname path.
Check this link
http://developer.android.com/training/basics/data-storage/files.html
Note : the sdcard path can be accessed if you connect to any external system ( PC).

JavaWebStart and resources like images and files

I have a doubt. I am using javawebstar in a swing project. In my app i have some images that I use to improve the design and a file .xls to show a report. I am using the method getClass().getResource("") to locate the images and I realized that my app try to find the resource in the web server using something like this: jar:http://www... . I thought that all resource would be sought in the local computer where the app was installed. Am I doing something wrong?
The app. will download the resources when needed and cache them on the local disks.
For security reasons the URL shown in the console will always point to the server, even for a trusted app. for which all the resources are cached.

Categories