1. the following formats are supported:
64. Midi, AAC, AAC +, Amr, WAV, MP3, Real Audio, WMA, and Ogg.
2. How to Use the audio files in sdcard as ringtones:
Create a folder under the root directory of the sdcard:
Media/Audio/ringtone (generally there are three sub-folders under the audio Folder: ringtones, alarms and notifications), and then copy the ringtone to the folder.
3. How to Use code to implement custom ringtones?
Verification is also required for code implementation.
Okay, the code is implemented:
File K = new file ("/sdcard/Media/Audio/ringtones", "therain.pdf "); <br/> // path is/sdcard/Media/ringtone <br/> contentvalues values = new contentvalues (); <br/> values. put (mediastore. mediacolumns. data, K. getabsolutepath (); <br/> // values. put (mediastore. mediacolumns. title, "My song title"); <br/> // values. put (mediastore. mediacolumns. size, 215454); <br/> values. put (mediastore. mediacolumns. mime_type, "audio/MP3"); <br/> // values. put (mediastore. audio. media. artist, "Madonna"); <br/> // values. put (mediastore. audio. media. duration, 230); <br/> values. put (mediastore. audio. media. is_ringtone, true); <br/> values. put (mediastore. audio. media. is_notification, false); <br/> values. put (mediastore. audio. media. is_alarm, false); <br/> values. put (mediastore. audio. media. is_music, false); <br/> // insert it into the databaseuri <br/> URI uri = mediastore. audio. media. getcontenturiforpath (K. getabsolutepath (); <br/> URI newuri = getcontentresolver (). insert (Uri, values); <br/> string testring = newuri. tostring (); <br/> ringtonemanager. setactualdefaultringtoneuri (ringtone. this, ringtonemanager. type_ringtone, newuri );