Hi guys I tried to set the ringtone from an appilcation but the application crash.
This is the code:
How can I solve this? Thanks.
This is the code:
Code:
@Override
public void onClick(View v) {
//I set the uri variable to the resource folder and for each positoin I set a difference quotes res id.
Uri uri = Uri.parse("android.resource://com.ghzncl.barneystinsonsoundboard/"+R.raw.single]);
RingtoneManager.setActualDefaultRingtoneUri(mContext, RingtoneManager.TYPE_NOTIFICATION, uri);
//I set the data source of the mPlayer. I pass to the method the context and the uri of the resource.
try{
//I reset the mPlayer to its uninitialized state, in this way I don't need to stop the previews running quotes.
mPlayer.reset();
mPlayer.setDataSource(mContext,uri);
}catch(Exception e){}
try{
mPlayer.prepare();
}catch(Exception e){}
//The quotes start
mPlayer.start();
}
How can I solve this? Thanks.