Android: save sound as ringtone / SQLiteConstraintException

我是研究僧i 提交于 2019-12-01 09:28:34

It is not caught because the exception is not in your code. It is not even in your process. It is in the process of the MediaStore content provider.

I was having the same issue....it's because you don't have this permission in your manifest

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

Also, if you're using that tutorial, make sure you have this in your manifest as well...

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

I spent a good half an hour or so trying to figure out why the code wasn't working. I actually removed the try/catch just to see what type of error it would throw in the logcat, and it told me I was missing those permissions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!