开发者

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜