发布于 2016-04-16 10:28:05 | 121 次阅读 | 评论: 0 | 来源: 网友投递
Android移动端操作系统
Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。
12-13 15:39:11.062: VERBOSE/MediaPlayerService(67): Create new media retriever from pid 349<BR>
12-13 15:39:11.082: DEBUG/MediaScannerService(349): getDefaultLocale =zh_CN
12-13 15:39:11.122: DEBUG/SurfaceFlinger(102): Layer::requestBuffer(this=0x7c8c68), index=1, pid=12866, w=309, h=192 success
12-13 15:39:11.142: INFO/MediaScanner(349): mOriginalCount = 14, prune thumb flag = false<BR>
12-13 15:39:11.142: DEBUG/MediaScanner(349): prescan time: 44ms<BR>
12-13 15:39:11.142: DEBUG/MediaScanner(349): scan time: 13ms<BR>
12-13 15:39:11.142: DEBUG/MediaScanner(349): postscan time: 2ms<BR>
12-13 15:39:11.142: DEBUG/MediaScanner(349): total time: 59ms<BR>
12-13 15:39:11.152: DEBUG/MediaProvider(349): un-lock thumbnail worker<BR>
12-13 15:39:11.152: DEBUG/MediaProvider(349): un-lock thumbnail worker<BR>
12-13 15:39:11.182: DEBUG/MediaScannerService(349): done scanning volume external
Cursor cursor = context.getContentResolver().query(<BR> MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,<BR> new String[] { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.TITLE,<BR> MediaStore.Audio.Media.DURATION, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM,<BR> MediaStore.Audio.Media.YEAR, MediaStore.Audio.Media.MIME_TYPE, MediaStore.Audio.Media.SIZE, MediaStore.Audio.Media.DATA}<BR> , "_size>?", new String[]{1024*1024+""},null);
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_SCANNER_STARTED);
intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
intentFilter.addDataScheme("file");
scanReceiver = new ScanSdFilesReceiver();
registerReceiver(scanReceiver, intentFilter);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));
private class ScanSdFilesReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_MEDIA_SCANNER_STARTED.equals(action)) {
scanHandler.sendEmptyMessage(STARTED);
}
if (Intent.ACTION_MEDIA_SCANNER_FINISHED.equals(action)) {
scanHandler.sendEmptyMessage(FINISHED);
}
}
}
private Handler scanHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case STARTED:
MyDialog scanDialog = new MyDialog(LocalList.this);
scanAlertDialog = scanDialog.scanFile();
scanAlertDialog.show();
Log.i(TAG, "showing");
break;
case FINISHED:
ArrayList<Song> tempSongs = ReadFileList.readDataFromSD(LocalList.this, LOCAL);
if (tempSongs != null && tempSongs.size()>0) {
if (songs != null && songs.size()>0) {
songs.clear();
songs.addAll(tempSongs);
songAdapter.notifyDataSetChanged();
}else {
songs = new ArrayList<Song>();
songs.addAll(tempSongs);
initSong_lv();
}
}else {
Toast.makeText(LocalList.this, "SD卡中没有歌曲,请添加后再扫描", Toast.LENGTH_SHORT).show();
}
Log.i(TAG, "finish");
if (scanAlertDialog!=null && scanAlertDialog.isShowing()) {
scanAlertDialog.dismiss();
}
unregisterReceiver(scanReceiver);
break;
case DISMISS:
Log.i(TAG, "dismiss");
if (scanAlertDialog!=null && scanAlertDialog.isShowing()) {
scanAlertDialog.dismiss();
}
default:
break;
}