我想获得手机的铃声,但仅查看英语(非定位版本(。
我的理论正在使用上下文处理器,并将上下文环境设置为 en_US
,并将该新的语言环境传递给RingtoneManager.getRingtone()
(以编程为基础的代码(:
ContextWrapper cw = new ContextWrapper(context);
Context cc = setContextLocale(cw, "en_US"); // This method was copied from the StackOverflow question above ^^
Ringtone defaultRingtone = RingtoneManager.getRingtone(cc, Settings.System.DEFAULT_RINGTONE_URI);
String sss = defaultRingtone.getTitle(cc);
所以,是的,这无法正常工作。有什么想法吗?
希望您能找到您想要的内容,其中包括以下代码段:
data class Ringtone(
val _id: String,
val title: String
)
val cursor = RingtoneManager(this).cursor
cursor.moveToFirst()
val list = ArrayList<Ringtone>()
do {
list.add(Ringtone(
cursor.getString(0),
cursor.getString(1)
))
} while (cursor.moveToNext())
Log.i(TAG, "ringtones list=$list")