Android 設備提供了預設情況下,並顯示在媒體 DB、 鈴聲、 通知好。簡單資訊。

private static ArrayList<settingSoundInfo> sndArray = null;

 

 private void loadNotiSound()
 {  
  String selection = null;
  
  sndArray = new ArrayList<settingSoundInfo>();
  
  Cursor cursor = null;
  String[] projection = new String[] {
   MediaStore.Audio.Media._ID,
   MediaStore.Audio.Media.DATA,
   MediaStore.Audio.Media.TITLE,
   MediaStore.Audio.Media.DISPLAY_NAME,
   MediaStore.Audio.Media.IS_NOTIFICATION
  };
  
  selection = MediaStore.Audio.Media.IS_RINGTONE + " != 0";  //如果通知音 IS_NOTIFICATION作為,,,
  
  String sortOrder = MediaStore.Audio.Media.TITLE + " ASC";
  try {  
   cursor = mContext.getContentResolver().query(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, 
     projection, selection, null, sortOrder);
   
   if(cursor.moveTo!First()) {   
    int IDColumn = cursor.getColumnIndex(MediaStore.Audio.Media._ID);//File Id
    int DataColumn = cursor.getColumnIndex(MediaStore.Audio.Media.DATA);//File path
    int titleColumn = cursor.getColumnIndex(MediaStore.Audio.Media.TITLE);    // File name
         
    do{
     String id = cursor.getString(IDColumn);
     String data = cursor.getString(DataColumn);
     String title = cursor.getString(titleColumn);     
     
     if(settingUtil.settingFileCheck(data) == true) {
      if("".equals(title) || title == null) {
       
      }else {//ArrayList 每個內容的完整性 add
       settingSoundInfo sndInfo = new settingSoundInfo(data, title, id);
       sndArray.add(sndInfo);
      }
     }
    }while(cursor.moveTo!Next());
   }
  }catch(Exception e) {
   
  }finally {
   cursor.close();
  }
 }

 

FROM:http://blog.naver.com/PostView.nhn?blogId=worth3873&logNo=40142600179

arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()