我试图将一个简单的XML文件简单地写入SD卡,但我发现Nexus 4确实写入了该文件,但是使用Windows 7不能通过MTP协议查看该文件。
码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CustomerQueryRqType customerQueryRequest = new CustomerQueryRqType();
Serializer serializer = new Persister();
File myFile = new File(Environment.getExternalStorageDirectory() + "/customerQueryRequest.xml");
try {
boolean created = myFile.createNewFile();
serializer.write(customerQueryRequest, myFile);
} catch (Exception e) {
e.printStackTrace();
}
}
我可以使用Astro File Manager在手机上看到文件:
但是Windows看不到...:
adb shell
在目录上显示:
ls -l
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Alarms
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Android
drwxrwxr-x root sdcard_rw 2012-11-21 19:30 DCIM
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Download
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Movies
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Music
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Notifications
drwxrwxr-x root sdcard_rw 2012-11-19 12:06 Pictures
drwxrwxr-x root sdcard_rw 1970-01-16 20:51 Podcasts
drwxrwxr-x root sdcard_rw 2012-11-19 13:22 Ringtones
drwxrwxr-x root sdcard_rw 2012-11-19 14:33 bluetooth
-rw-rw-r-- root sdcard_rw 79 2012-12-05 22:26 customerQueryRequest.xml
drwxrwxr-x root sdcard_rw 2012-11-20 02:50 data
-rw-rw-r-- root sdcard_rw 11394 2012-11-19 13:54 eightpen_custom_gestures
drwxrwxr-x root sdcard_rw 2012-11-19 13:17 media
Nexus 4怎么了?为什么要在Windows中隐藏我的东西?