When I created a preferences xml file (by right-clicking the project name, selecting | New | Other | Android XML File, and then selecting "Preference" from the "Resource Type" spinner in the "New Android XML File" dialog), it saved it in res/xml rather than res/layout. Is this as it should be?
Asked
Active
Viewed 6,325 times
2 Answers
11
Yes, the preference xml file should be in the res/xml
directory.
The res/layout
directory, as the name suggests, is only for layout xml files.

Bruno Bieri
- 9,724
- 11
- 63
- 92

HXCaine
- 4,228
- 3
- 31
- 36
-
Thanks; a preferences xml file does seem rather like a layout file to me, though - after all, you are manipulating the UI of the Preferences screen therein, right? – B. Clay Shannon-B. Crow Raven Jan 21 '12 at 03:20
-
1You don't really manipulate the UI of the Preferences screen, you just fill in what kind of preferences you want and the pre-prepared layout is filled in for you. Your layout files, however, actually define where on the screen things are laid – HXCaine Jan 21 '12 at 12:48
5
By Default the SharedPreference file is store in to the respective Project directory with that preference name and with xml formate.
If you want to see that file or view the data of that file in Eclipse then do as below:
goto FileExplorer in DDMS of Eclipse then
data/data/YOUR_APPLICATIO_PACKAGE/shared_prefs/abc.xml
Here, abc.xml is your preference file that you have created during the application execution. Now copy that file to the PC and you can view the data and its value that you have saved to the shared_prefs.
Enjoy. :)

Shreyash Mahajan
- 23,386
- 35
- 116
- 188
-
BTW, this answer is talking about a different preferences file than OP. http://stackoverflow.com/questions/6146106/where-are-shared-preferences-stored has more discussion of an app's run-time shared preferences file. The question here is about a **development time** preferences file, which **specifies** the names and types of preferences (aka user settings) that the user can set for your app: http://developer.android.com/guide/topics/ui/settings.html#DefiningPrefs – ToolmakerSteve Jun 17 '15 at 20:53