如何检查物理SD卡是否已安装或移除?
<receiver android:name=".MyReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_REMOVED" />
<action android:name="android.intent.action.MEDIA_MOUNTED" />
</intent-filter>
使用此意图过滤器定义广播接收器不会对任何内容做出反应
答案 0 :(得分:0)
// try this
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
// External SD card not mounted
}else{
// External SD card mounted
}