标签:缓存 odi rom as3 drag sdi F12 god bcb
2016.10.21:
之前的更新都没有贴出来。接下来对应用还会有一些重构,每隔一阶段将更新工作总结一下贴上来,顺路学习下git的命令行操作。
Version:2.2
地址:https://github.com/yusband/HotMovie/tree/HotMovie2.2
New Features:
遇到的坑:
opendir failed, Permission denied
的错误提示private static final int MOVIE =100 ; private static final int MOVIE_ALL =200 ; private static final int MOVIE_CERTAIN =300 ; private OpenHelper mOpenHelper; static UriMatcher buildUriMatcher() { UriMatcher matcher=new UriMatcher(UriMatcher.NO_MATCH); final String authority=MovieContact.CONTENT_AUTHORITY; matcher.addURI(authority,MovieContact.PATH_MOVIE, MOVIE); matcher.addURI(authority,MovieContact.PATH_MOVIE+"/*",MOVIE_ALL); matcher.addURI(authority,"movie/#",MOVIE_CERTAIN);
public int delete(Uri uri, String s, String[] strings) { final SQLiteDatabase db = mOpenHelper.getWritableDatabase(); final int match = sUriMatcher.match(uri); int deleteRows=0; switch (match) { case MOVIE_CERTAIN: { deleteRows=db.delete(MovieContact.MovieEntry.TABLE_NAME,s,strings); if ( deleteRows<= 0 ) throw new android.database.SQLException("Failed to insert row into " + uri); break; } case MOVIE_ALL: { Log.i("movie_all",""); } case MOVIE:{ Log.i("movie",""); } default: throw new UnsupportedOperationException("Unknown uri: " + uri); } getContext().getContentResolver().notifyChange(uri, null); return deleteRows; }
以上是继承自ContentProvider类中的UriMatcher和delete方法,运行会抛出 预定义的UnsupportedOperationException异常
应当避免在addUri时将*/# 与 */*放在相邻的两行,这里尽管在addUri中定义了如图所示的uri,当match时会因为CONTENT_URI/*在前,而且segment形式一致,会直接返回match CONTENT_URI/*的结果,会抛出异常。
当在初始化uriMatcher()的过程中,将CONTENT_URI/*和CONTENT_URI/#的顺序交换,便不会抛出异常;这也提醒在定义UriMatcher的过程中,需要注意顺序,格式可以参考官方文档:
sURIMatcher.addURI("contacts", "people", PEOPLE); sURIMatcher.addURI("contacts", "people/#", PEOPLE_ID); sURIMatcher.addURI("contacts", "people/#/phones", PEOPLE_PHONES); sURIMatcher.addURI("contacts", "people/#/phones/#", PEOPLE_PHONES_ID); sURIMatcher.addURI("contacts", "people/#/contact_methods", PEOPLE_CONTACTMETHODS); sURIMatcher.addURI("contacts", "people/#/contact_methods/#", PEOPLE_CONTACTMETHODS_ID); sURIMatcher.addURI("contacts", "deleted_people", DELETED_PEOPLE); sURIMatcher.addURI("contacts", "phones", PHONES); sURIMatcher.addURI("contacts", "phones/filter/*", PHONES_FILTER); sURIMatcher.addURI("contacts", "phones/#", PHONES_ID); sURIMatcher.addURI("contacts", "contact_methods", CONTACTMETHODS); sURIMatcher.addURI("contacts", "contact_methods/#", CONTACTMETHODS_ID); sURIMatcher.addURI("call_log", "calls", CALLS); sURIMatcher.addURI("call_log", "calls/filter/*", CALLS_FILTER); sURIMatcher.addURI("call_log", "calls/#", CALLS_ID);
标签:缓存 odi rom as3 drag sdi F12 god bcb
原文地址:http://www.cnblogs.com/Russel/p/5984789.html