开发者

SQLException in contentProvider

开发者 https://www.devze.com 2023-03-11 03:33 出处:网络
开发者_运维问答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 t

开发者_运维问答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

精彩评论

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