设为首页 加入收藏

TOP

Android上拔出sd卡导致flash上媒体也消失问题解决方法
2014-11-24 07:48:44 来源: 作者: 【 】 浏览:0
Tags:Android 拔出 导致 flash 媒体 消失 问题 解决 方法

机器内部有一部分flash供客户使用,同时机器支持sd卡。当插入sd卡时候flash内部和sd卡内部的多媒体都可以被播放器识别,一旦拔掉sd卡,则flash内的媒体对播放器也不见了。


解决方法:


mContext.sendBroadcast(intent);


intent = new Intent(Intent.ACTION_MEDIA_REMOVED,


Uri.parse("file://" + path));


mContext.sendBroadcast(intent);


//添加下面几行


intent = new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://" + "flash"));


intent.putExtra("read-only", false);


mContext.sendBroadcast(intent);



}


同时也修改notifyMediaUnmounted(),在最后也加入上面几行



Intent intent = new Intent(Intent.ACTION_MEDIA_UNMOUNTED,


Uri.parse("file://" + path));


mContext.sendBroadcast(intent);


//添加开始


intent = new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://" + "flash"));


intent.putExtra("read-only", false);


mContext.sendBroadcast(intent);


//添加结束


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇在Android中加入充电指示 下一篇Android NDK的C/C++代码中利用JNI..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·JAVA现在的就业环境 (2025-12-26 01:19:24)
·最好的java反编译工 (2025-12-26 01:19:21)
·预测一下2025年Java (2025-12-26 01:19:19)
·Libevent C++ 高并发 (2025-12-26 00:49:30)
·C++ dll 设计接口时 (2025-12-26 00:49:28)