Android ContentResolver 值的长度

Android ContentResolver length of value

我只想过滤已知号码的呼叫日志,但我在 len() 函数中遇到崩溃(没有这样的函数:len(代码 1))

cursor = context.getContentResolver().query(CallLog.Calls.CONTENT_URI, null,
                CallLog.Calls.TYPE + "=" + CallLog.Calls.INCOMING_TYPE +
                " AND len(" + CallLog.Calls.NUMBER + ") > 3",
                null, CallLog.Calls.DATE);

感谢帮助

您应该使用 length 而不是 len

For a string value X, the length(X) function returns the number of characters (not bytes) in X prior to the first NUL character. Since SQLite strings do not normally contain NUL characters, the length(X) function will usually return the total number of characters in the string X. For a blob value X, length(X) returns the number of bytes in the blob. If X is NULL then length(X) is NULL. If X is numeric then length(X) returns the length of a string representation of X.