我无法理解以下代码中的某些概念:
1) 为什么我们使用.arg0.getPathSegments().get(1)?
2) get(1) 的值是多少?
3) (!TextUtils.isEmpty(arg1) 的功能是什么?" AND (" + arg1 + ')' : ""), arg2);
public int delete(Uri arg0, String arg1, String[] arg2) {
int count=0;
switch (uriMatcher.match(arg0)){
case BOOKS:
count = booksDB.delete(
DATABASE_TABLE,
arg1,
arg2);
break;
case BOOK_ID:
String id = arg0.getPathSegments().get(1);
count = booksDB.delete(
DATABASE_TABLE,
_ID + " = " + id +
(!TextUtils.isEmpty(arg1) ? " AND (" +
arg1 + ')' : ""),
arg2);
break;
default: throw new IllegalArgumentException(
"Unknown URI " + arg0);
}
getContext().getContentResolver().notifyChange(arg0, null);
return count;