Android选择设备的闹钟音和存储

时间:2014-03-26 12:37:59

标签: java android ringtone

嗨我想要检索设备的音色列表并选择它还将所选的uri存储在变量上...我能够制作列表并显示所有设备的音调但是uri返回空值...我该如何存储所选音调的uri ... plz帮助我...... 这是我试过的......

 Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
                            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,RingtoneManager.TYPE_RINGTONE); intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Tone");
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, uri);
getActivity().startActivityForResult(intent, 5); 


                 public void onActivityResult(final int requestCode, final int resultCode, final Intent intent)
                 {
                    // TODO Auto-generated method stub
                     if (resultCode == Activity.RESULT_OK && requestCode == 5)
                     {
                           uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
                           Toast.makeText(getActivity(), uri.toString(), 5000).show();
                          if (uri != null)
                          {
                              this.chosenRingtone = uri.toString();
                              select_ring=uri.toString();
                          }

                      }          
                }

0 个答案:

没有答案