Create folder inside android folder of android device - android

We all know there is always a folder in android named Android which always contains data of app.
I saw many app folder inside it which store their file there.
So my question is how can i create a folder inside android folder of an android device and store my application data inside of it?
Please suggest something

We all know there is always a folder in android named Android which always contains data of app
I am assuming that you are referring to the Android/ directory seen in what the Android SDK refers to as external storage.
how can i create a folder inside android folder of an android device and store my application data inside of it?
Use getExternalFilesDir(), getExternalCacheDir(), or getExternalMediaDir(), all methods available on implementations of Context, such as Activity and Service.
Also, if you want to be able to see the files that you create from your desktop OS, you will need to arrange to have the files indexed by the MediaStore.

Related

Downloadable files in my application

I created a project which uses Fragments, and in one of them I want to add some clickable icons that will allow to download a file (one per icon).
I have the files stored on my computer.
I suppose that they have to be copied into my application.
How I can implement this in the code?
I hope that this picture can explain what I want to do.
will allow to download a file and they have to be copied into my application don't match: If the files are already on the device (once your app is installed), what is the sense of downloading those files again?
Therefore, either provide your files inside your app or use a file server and download them.
If you decide to provide the files in your app, this will increase the installation time.
But it would not require an internet connection to download the files again.
So, simply put your files in the raw or in the assets folder and that's all.
Then simply access your files from that folder.
If the folder isn't already found in your project, simply create it and drop your files in it.

Directory for saving/accessing files in Android

I'm currently developing an app in Android Studio for Android TV on a mac. Ultimately I want to load local image files as card images in a VerticalGridFragment where a card id and an image filename have matching numbers. For the sake of prototyping, right now I'm just trying to set up best practices (as a complete novice) with a single 1.jpg file that will appear on every card.
I'm using the included Android TV emulator and assume I shouldn't attempt to use access or make use of any OSX file system. So my two questions are:
While I'm prototyping and trying to get 1.jpg to be the image for
each card, where should I place this file in a manner that I can
access using a file path string for internal storage, such as /root/1.jpg
which I can later change to /root/$.jpg where $ is a dynamic id
associated with each card. This needs to satisfy both the emulator
being able to access the file, a device being able to access the file when the app is finished, and me being able to place files there
from my host os while prototyping.
A follow-on question. When the app is finished I obviously won't be
relying on manually placing image files. Will the solution to the
above also provide a straightforward means of saving images to this
directory on a device?
Thanks.
Ok, I think I've got my head around this now:
Inside Android Studio, there's a Monitor utility in which there's a File Explorer. Using this, you can browse, and save to the directory structure that the emulator's using.
Most importantly, there is a standard assigned directory for apps to save and open from on internal storage. It can be found in the file browser at /data/data/com.applicationname/files/
From any app, it can be referenced for saving to or opening from using getFilesDir(), which answers question 2.

Associate a folder to an APK

In the app I was helping developing, the users seen that each time they use apps like CM Security to clean 'junk', the files inside the folder associated with the app were instead considered as 'junk' and are deleted.
The app itself would create the folder in the C side of the code instead of using Java.
Firstly, when the app is first launched, custom C code will check if the app folder (e.g. 'Game') exists. If it doesn't, it makes it (regardless of OS. The app is cross-platform, sorry I forgot to say it.) It puts it in the external SD card ('sdcard/'). When it's seen, it can now run the app.
I get about the getFilesDir, but since the directory is made using C code and not through the java activity, it doesn't count as its app directory.
Is there a way to link the folder to the Android code so that it would be recognized as the app folder?

How do I access my app's package folder in Android using Adobe AIR / Flex?

I have an application for Android built using Flex. I need to save some configurations and data so I want to know how I can access the package-specific folder for my app instead of creating my own folder and writing there.
The package-specific folder I'm talking about is at /sdcard/Android/data/com.mysite.myapp/. Do I just access it directly via that path or is there a variable for File class that I'm not aware of?
The reason why I want to save onto this folder is because, if I create my own folder and save there, that would require my app to request the permission to access SD card contents. Something I don't want to include in my permission list.
For app specific files, you can choose either applicationDirectory (read only), or applicationStorageDirectory.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html

Pushing gestures Data programatically onto the raw folder

I want to push the data stored in the gestureslibrary onto my raw folder in the project.I want to do this in my program via code and not manually.How do i do this?
An application's apk file and the folders it contains are not writable by the application. You will have to store the information in private storage or external storage.
If you mean you want to automatically include something when building the application, look into extending your build system (IDE or ant) with a custom script.

Categories

Resources