Reputation: 11
I have my own XML files in a ./values folder. However I have no idea how to use/ call them. Any suggestions?
Upvotes: 0
Views: 718
Reputation: 306
Use it in xml as:
< include layout="@xml/yourfile" android:id="@+id/yourXmlId" />
You can also use it in Java as:
XmlPullParser yourXml = getResources().getXml(R.xml.yourfile);
You could also place the xml file in other folders like "layout", "drawable", "anim", "dimen" etc., depending on your use case or requirement.
Upvotes: 2
Reputation: 66
Can you mention what is the purpose of that xml?Is it created for creating background?I f you created it for drawing some shapes or your on images,please put it in drawable(res/drawable) folder.If your xml is for color,config,dimension,string,or style, put inside res/values folder.You can also create xml for menu related stuffs.Such xml can be put inside menu folder.
Upvotes: 0