Skip to content Skip to sidebar Skip to footer

The Method Setactualdefaultringtoneuri(context, Int, Uri) In The Type Ringtonemanager Is Not Applicable For The Arguments Onitemclicklistener

I am making android application and I want when I click on list view item to find ID of clicked item, get resources and set that file as ringtone.However I get this error : The met

Solution 1:

You are within the OnItemClickListener interface so this will referrence to it.

To avoid this just place the Name of your Activity before this or ask getApplicationContext() for context

Like:

RingtoneManager.setActualDefaultRingtoneUri(
     MainActivity.this, RingtoneManager.TYPE_RINGTONE, newUri);

or

RingtoneManager.setActualDefaultRingtoneUri(
     getApplicationContext(), RingtoneManager.TYPE_RINGTONE, newUri);

do the same for MediaPlayer.create(MainActivity.this, R.raw.aint);

Post a Comment for "The Method Setactualdefaultringtoneuri(context, Int, Uri) In The Type Ringtonemanager Is Not Applicable For The Arguments Onitemclicklistener"