Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should a Preferences .xml file go?

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?

like image 716
B. Clay Shannon-B. Crow Raven Avatar asked Jan 21 '12 01:01

B. Clay Shannon-B. Crow Raven


2 Answers

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. :)

like image 27
Shreyash Mahajan Avatar answered Sep 28 '22 16:09

Shreyash Mahajan


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.

like image 178
HXCaine Avatar answered Sep 28 '22 16:09

HXCaine