I've been trying to create a normal XML file in Android studio for manual RSS feed but android studio not letting me to create it. I just started using Android studio & migrated from eclipse.
Here's the options for File->New
In fact, it is simple. You need to put "ordinary" xml file inside "raw" folder and you can create it by clicking new->file and setting its name to rss.xml for example.
If you dont have raw folder then right-click on res->new->Android res directory select resource type to raw and click ok
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 am new to android. I am following this tutorial in android studio. Actually, that tutorial is developed in eclipse.
In that tutorial, I need to have layout_large. But I don't see that in android studio. So, I create layout_large as android resource directory and try to add xml file. But, I can't add there because I don't see layout resource file. How can I add layout_large in android studio?
I am just following this tutorial. http://www.newthinktank.com/2013/08/android-development-17/
Call context menu on res folder and choose New->Android resource directory.
In the dialog choose Resource type to layout and add to Directory name "-large".
Then copy layout you want to change from res/layout folder to layout-large.