Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时我会得到带有 sql 错误日志的堆栈跟踪。我不希望我的数据库逻辑对用户可见。如果出现 sql 错误,是否可以防止记录 sqlite 错误?
谢谢
使用insertOrThrow并将您的代码包围在try catch块中
参考http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#insertOrThrow%28java.lang.String,%20java.lang.String,%20android.content.ContentValues%29