Can i play a tone which is present in assets using Android Ring tone manger? I know i can use the tone copied in Res folder in following manner:
Uri inAppsoundUri = Uri.parse("android.resource://"
+ mAppContext.getPackageName() + "/raw/" + tone);**
ringTone = RingtoneManager.getRingtone(mAppContext,
inAppsoundUri);**
ringTone.play();
But when i tried replacing /raw/
with /assets/
in inAppsoundUri, it resulted in error. Actually i want to copy the tones to Sdcard also for some app specific usage for which i have to keep these tones files in assets, and also some times i have to play it through Ringtone manager for which i have to copy the same files in Res/raw folder. So there is unnecessary 2 copies of same tone files are present in the apk which results in larger apk size. So could you please suggest any way to do this both the functions(i.e. copy to sdcard and play using Android Ringtone mnager) from same place?
I am check it but i think it help you.
and place tone.mp3 in assert folder.
Thanks