Skip to main content
edited body
Source Link
bunbun
  • 2.7k
  • 4
  • 36
  • 54

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not.

More Specificspecifically: I am trying to grab the output of RingtoneManager's RingtonePickerRingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri;SetActualDefaultRingtoneUri:

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 For Rainy Days"); startActivityForResult(intent, 0); RingtoneManager.setActualDefaultRingtoneUri(this ,RingtoneManager.TYPE_RINGTONE ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI); 

Problem beingThe problem is that ,RingtoneManager.EXTRA_RINGTONE_PICKED_URIRingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a uriURI. There might be a better way than to convert the string to a UriURI. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

Thanks

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not.

More Specific: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri;

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 For Rainy Days"); startActivityForResult(intent, 0); RingtoneManager.setActualDefaultRingtoneUri(this ,RingtoneManager.TYPE_RINGTONE ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI); 

Problem being that ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a uri. There might be a better way than to convert the string to a Uri. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

Thanks

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not.

More specifically: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri:

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 For Rainy Days"); startActivityForResult(intent, 0); RingtoneManager.setActualDefaultRingtoneUri(this ,RingtoneManager.TYPE_RINGTONE ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI); 

The problem is that RingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a URI. There might be a better way than to convert the string to a URI. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

alignment, code, readability
Source Link
Noctis
  • 11.8k
  • 3
  • 46
  • 86

Question: I have found that java.net.URIjava.net.URI has a create(String uri) option but the android.net.uriandroid.net.uri does not.

More Specific: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri;

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 For Rainy Days"); startActivityForResult(intent, 0);

RingtoneManager.setActualDefaultRingtoneUri(this,RingtoneManager.TYPE_RINGTONE,RingtoneManager.EXTRA_RINGTONE_PICKED_URI);

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 For Rainy Days"); startActivityForResult(intent, 0); RingtoneManager.setActualDefaultRingtoneUri(this ,RingtoneManager.TYPE_RINGTONE ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI); 

Problem being that ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a uri. There might be a better way than to convert the string to a Uri. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

Thanks

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not.

More Specific: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri;

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 For Rainy Days"); startActivityForResult(intent, 0);

RingtoneManager.setActualDefaultRingtoneUri(this,RingtoneManager.TYPE_RINGTONE,RingtoneManager.EXTRA_RINGTONE_PICKED_URI);

Problem being that ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a uri. There might be a better way than to convert the string to a Uri. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

Thanks

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not.

More Specific: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri;

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 For Rainy Days"); startActivityForResult(intent, 0); RingtoneManager.setActualDefaultRingtoneUri(this ,RingtoneManager.TYPE_RINGTONE ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI); 

Problem being that ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a uri. There might be a better way than to convert the string to a Uri. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

Thanks

Source Link
FeelTheBurns
  • 1.1k
  • 2
  • 8
  • 14

How to convert a String to an android.net.Uri

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not.

More Specific: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri;

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 For Rainy Days"); startActivityForResult(intent, 0);

RingtoneManager.setActualDefaultRingtoneUri(this,RingtoneManager.TYPE_RINGTONE,RingtoneManager.EXTRA_RINGTONE_PICKED_URI);

Problem being that ,RingtoneManager.EXTRA_RINGTONE_PICKED_URI returns a string not a uri. There might be a better way than to convert the string to a Uri. I cannot find a reason why java.net.URI can do it and android.net.Uri can't.

Any suggestions would be appreciated!

Thanks