Android的安装卸载SD卡 [英] android mount unmount sd card

查看:567
本文介绍了Android的安装卸载SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作,它可以扫描SD卡的应用程序。在这个时候,我使用的Eclipse的模拟器来测试我的android应用。我创建了一个虚拟的SD卡上的Eclipse测试目的。

I am working on an application that scans the sd card. At this time, I am using the emulator of eclipse to test my android application. I have created a virtual sd-card for testing purposes on eclipse.

我想知道是否有什么办法未安装,然后在模拟器上(日蚀),这样我可以测试自己的应用程序,当SD卡被卸载,它应该产生一个消息等安装在SD卡..

I want to know if there is any way of un-mounting and then mounting the sd card on the emulator (eclipse) so that I can test my application that when the sd-card is unmounted, it should generate a message etc..

谁能帮我在这里..

推荐答案

有可能引导设备,而无需外部存储,它允许您测试,当你没有得到Environment.MEDIA_MOUNTED状态会发生什么。

It is possible to boot the device without the external storage, which allows you to test what happens when you do not get the Environment.MEDIA_MOUNTED state.

只是与现有的SD卡.iso文件创建AVD。然后,重命名文件。当您加载此AVD,它会工作得很好,但它不会有外部存储加载。这使您可以测试你的逻辑,当外部媒体没有安装的。

Just create an AVD with an existing SD card .iso file. Then, rename the file. When you load this AVD, it will work just fine but it won't have the external storage loaded. This allows you to test your logic for when the external media isn't mounted.

我创建了一个单独的AVD用于测试无外部存储方案,但您可以重命名.iso文件,如果你想在同一台运行测试重新启动仿真。

I created a separate AVD for testing the no-external-storage scenario, but you could rename the .iso file and restart the emulator if you want to run both tests on the same one.

我也尝试上述的umount方法,虽然它是非常有用的(如托普提到,这是一个严厉的测试),系统仍然认为SD卡的安装和我的备用逻辑不运行。

I did try the umount method above, and while it's useful (as Torp mentions, it's a harsher test), the system still thinks the SD card is mounted and my alternate logic isn't run.

这篇关于Android的安装卸载SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆