I am android beginer. I wanted to add audio file into my android application. In one of the tutorials i found that audio file need to be added to "RAW"folder but i am not finding such folder in my eclipse indigo version. somebody please tell me, did i delete it by mistake or have i not installed some file?
you should create it yourself, put it in the res folder and name it raw (lower case).
You can do it by two ways:
Right click on res folder and create a folder named raw
Clear / Rebuild your project
Or you can do it manually:
Go throught the workspace projects go to your application / your package name / res / (Then you right click) Create Folder and named it raw.
Restart the IDE and it will appear.
Related
I made a UI layout using adobe XD and wanted to export it to use in android studio.
I achieved this by using the Export-kit plugin, which conveniently exported all my required assets for one page into a folder.
Exported assets folder
the readme.txt then directs me to copy all these assets to the folder for the noactivity project folder for android studio.
after doing so , I still don't get any response.
So, I try it with a basic activity and manually add all the required XML codes (activity_main,colours,styles,e.t.c) , but still don't see anything.
I know that the skins exported from xd are in the project folder
(Copied values in the projects folder)
but I cant seem to view them on android studio.
Android Studio Window
any help in this issue will be really appreciated.
You have to put those files in the drawables folder inside the res folder, and keep the colors, string into their respective folder in the values folder inside res.
I have a Xamarin.Forms app that needs to read data from a json file. I placed the file into the Android assets folder and selected the build action AndroidAssets
Then I try to load the file in MainActivity with Assets.Open(filename) and I get a FileNotFoundException. I deleted the Android and PCL bin folders and tried to build the project again but got the same result. Then I opened the .apk file in WinRar and when I go to the assets folder, the files that I added to the project are not there.
Does anyone have any idea what's the problem here?
Did you set the files as embedded resources from the file properties?
If you not, right click on the file -> Properties -> set as Embedded Resources in Build Action
The problem was with using the "-" character in resource file names. Changed it as suggested by York Shen and it started working as it was supposed to.
I am using Android Studio 2.1.1 (currently the most updated stable version).
I created new directory inside 'res' by name "values-21"
and it don't shows up.
But if I go to the physical location of 'res' on the hard drive I can see that its exist.
and of course I checked using both Android and Project Files structure but either way its not showing it.
I wanted to check where is the problem so I created another directory by name "menu", and the last one was shown.
just to be sure I tried to create the same directory again ("values-21") but Android studio didn't allowed it because this directory allready exist's.
any ideas how to fix it?
Update - the solution is to create new directory using the "Android resource Directory" option and not by "Directory" option.
all you values xml files stored in values, values-21, values-mdpi or other physical folder in AndroidStudio displayed in one res/values folder.
It will not show until you copy a XML file into values-21, android studio consider all values folders to be of same family and it shows only one folder and the files with post script of the family in which it lies.
copy some layout file from resource directory and through windows explorer paste in that the folder that you have created i.e values-21 and now come back to android studio and check the folder should be there.
Happy coding
Recently I installed Android Studio, before I used Eclipse. While using Eclipse I could put all the files in Assets directory and access it using getassets method. For example:
InputStream ims = getAssets().open("textnew.txt");
Can you please advise:
Where to store files in Android Studio? Should I create folders in /res directory myself and put files there. For example: res/raw/textnew.txt
How to access those files? For example I need to open txt file in order to place its content to TextView. How to do it?
Thanks!
You can still use an asset folder in Android Studio.
Create manually a folder asset in your app directory.
Using the menus : File / New / Folder / Assets Folder
I think that the only difference with Eclispe is that in Android Studio the folder is not created by default.
Android Studio has a nice assistant to create an asset-folder. This way it will be created in the correct location.
Right Click on your project
Click "New" -> "Folder" -> "Assets-Folder"
Follow the assistant
Your folder should be created and will be added to your main-sourceset.
I'm using a default Eclipse project file generated for my Android application, and I want to keep it in a targets/ directory (along with other eclipse-specific files) in order to better organize my project structure (I also plan on adding a target for NetBeans).
Simple question, I suppose: Is this possible?
Coming back to this question, Ryan Conrad is correct in that Eclipse needs the .project files in the root of the project directory. As such it is not possible to move it elsewhere.
You can define target or output destination by change the output folder. I guess you can do that by change the dir path under Property of the Android project.
If you want to reorganize all your Eclipse projects, you can create a new workplace (Files/Switch workplace) and start creating new projects from now on.