Android Ringtonemanager ringtone Manager

Source: Internet
Author: User
Tags null null

Get default ringtone uri/

Uri String

Uri sound = Ringtonemanager.getdefaulturi (type);
(type = Ringtonemanager.type_ringtone or ringtonemanager.type_notification or ringtonemanager.type_alarm
The same as below)

Get ringtone uri/

Uri string

String getringtoneuripath (int type,int pos) {
Ringtonemanager manager = new Ringtonemanager (mcontext);
Manager.settype (type);

//workaround to create mcusor inside manager, or raise a segamentation fault whil E invoking Getringtoneuri, below methods same too

Cursor cursor = manager.getcursor ();

Uri uri = Manager.getringtoneuri (POS);
return uri==null null:uri.toString ();
}

Get ringtone Title list<string> getringtonetitlelist (int type) {

list<string> Resarr = new arraylist<string> ();
Ringtonemanager manager = new Ringtonemanager (mcontext);
Manager.settype (type);
cursor cursor = manager.getcursor ();
if (Cursor.movetofirst ()) {
do{
Resarr.add (cursor.getstring (Ringtonemanager.title_column_index));
}while (Cursor.movetonext ());
}
return Resarr;
}

Gets the specified type of

Specify entry ringtone Action class

Ringtone getringtone (int type,int pos) {

Ringtonemanager manager = new Ringtonemanager (mcontext);
Manager.settype (type);
Return Manager.getringtone (POS);
}

Gets all of the specified types

Ringtone action list

list<ringtone> getringtonelist (int type) {
list<ringtone> Resarr = new arraylist<ringtone> ();
Ringtonemanager manager = new Ringtonemanager (mcontext);
Manager.settype (type);
cursor cursor = manager.getcursor ();
int count = Cursor.getcount ();
for (int i = 0; i < count; i + +) {
Resarr.add (Manager.getringtone (i));
}
return Resarr;
}

Android Ringtonemanager ringtone Manager

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.