开发者

how can i view my android app preferences in eclipse

开发者 https://www.devze.com 2023-01-04 18:26 出处:网络
I can access the preferences and add and change them.How can I view the entire file that stores the keys and value开发者_开发问答s for sharedpreferences in my app.I have changed, added and removed som

I can access the preferences and add and change them. How can I view the entire file that stores the keys and value开发者_开发问答s for sharedpreferences in my app. I have changed, added and removed some keys from my code and would like to see the effect on the preference file.


Eclipse, menu/Window/Show View/File Explorer. If "File Explorer" is not in the menu, then click "Other..." and find it under the Android category.

In the file tree, find your app's data folder under /data/data/com.your-package/shared_prefs. The preference file will be there, as an XML. Copy it from the device and enjoy. In the upper right corner of the File Explorer view, there are two icon buttons - one with a disk and one with a mobile phone. These buttons will allow you to copy files from and to the phone/emulator, respectively.

Alternatively, you can open a command line to the device/AVD using the ADB tool, and use the UNIX standard "cat" command. Like this:

C:\android-sdk-windows\platform-tools\adb shell cat /data/data/com.your-package/shared_prefs/*

Assuming there's only one connected device or running emulator at the time.


you can view preference file contents using adb

Use following Commands

$./adb shell
#cd data
#cd data
#cd org.vipul
#cd shared_prefs
#ls
org.vipul_preferences.xml
#cat org.vipul_preferences.xml   
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<string name="update">30</string>
<boolean name="boot" value="false" />
<string name="pwd">Shah</string>
<string name="uname"></string>
</map>
0

精彩评论

暂无评论...
验证码 换一张
取 消