SQLException in contentProvider
开发者_运维问答Everybody knows NotePad exaple for android. Its content provider contains "throw new SQLException("Failed to insert row into " + uri);" in the end of insert method, but when I try to use this row in my own contentProvider Eclipse shows an error "Unhandled exception type SQLException".
How can I throw this Exception from this method?
You need to tell the compiler that this method will throw this exception so add "throws SQLException" to your method header e.g.
public Uri insert(Uri uri, ContentValues values) throws SQLException {
//dostuff
}
精彩评论