The method d(String, String) in the type Slog is not applicable for the arguments (String)
时间: 2024-05-31 11:10:19 浏览: 109
这个错误是因为你调用了Slog类中的d(String, String)方法,但是你只传递了一个字符串参数,而该方法需要两个字符串参数。
请检查你的代码并确保你正确地使用了Slog类中的d方法,并传递了两个字符串参数。如果你还是无法解决问题,请提供更多的上下文和代码,这将有助于我更好地理解你的问题并提供更准确的答案。
相关问题
void reportUidInfoMessageLocked(String tag, String msg, int uid) { Slog.i(TAG, msg); if (mCurOomAdjObserver != null && uid == mCurOomAdjUid) { mUiHandler.obtainMessage(DISPATCH_OOM_ADJ_OBSERVER_MSG, msg).sendToTarget(); }
这段代码来自于 Android 操作系统的一个服务,可以看到它的作用是在特定情况下上报 UID 相关的信息。具体来说,它会打印一条信息,然后判断当前是否存在 OomAdjObserver(一个内存管理的观察者),如果存在并且当前的 UID 等于观察者关心的 UID,就会将信息通过消息的方式发送给观察者。
这段函数代表什么 public int compareTo(WindowContainer other) { Slog.d("huangbg", Log.getStackTraceString( new Throwable())); Slog.d("huangbg","other = " + other); if (this == other) { Slog.d("huangbg"," compareTo 929"); return 0; } Slog.d("huangbg"," mParent = " + mParent); if (mParent != null && mParent == other.mParent) { Slog.d("huangbg"," compareTo 934"); final WindowList<WindowContainer> list = mParent.mChildren; return list.indexOf(this) > list.indexOf(other) ? 1 : -1; } final LinkedList<WindowContainer> thisParentChain = mTmpChain1; final LinkedList<WindowContainer> otherParentChain = mTmpChain2; try { getParents(thisParentChain); other.getParents(otherParentChain); // Find the common ancestor of both containers. WindowContainer commonAncestor = null; WindowContainer thisTop = thisParentChain.peekLast(); WindowContainer otherTop = otherParentChain.peekLast(); while (thisTop != null && otherTop != null && thisTop == otherTop) { commonAncestor = thisParentChain.removeLast(); otherParentChain.removeLast(); thisTop = thisParentChain.peekLast(); otherTop = otherParentChain.peekLast(); } Slog.d("huangbg"," commonAncestor = " + commonAncestor); // Containers don't belong to the same hierarchy??? if (commonAncestor == null) { throw new IllegalArgumentException("No in the same hierarchy this=" + thisParentChain + " other=" + otherParentChain); } // Children are always considered greater than their parents, so if one of the containers // we are comparing it the parent of the other then whichever is the child is greater. if (commonAncestor == this) { Slog.d("huangbg"," compareTo 965"); return -1; } else if (commonAncestor == other) { Slog.d("huangbg"," compareTo 968"); return 1; } Slog.d("huangbg"," compareTo 971"); // The position of the first non-common ancestor in the common ancestor list determines // which is greater the which. final WindowList<WindowContainer> list = commonAncestor.mChildren; return list.indexOf(thisParentChain.peekLast()) > list.indexOf(otherParentChain.peekLast()) ? 1 : -1; } finally { mTmpChain1.clear(); mTmpChain2.clear(); } }
这段代码是一个比较函数,它重写了 Java 中的 Comparable 接口中的 compareTo 方法。它的作用是用于比较两个 WindowContainer 对象的大小。在代码中,首先使用了 Slog.d() 方法输出了一些日志,用于调试。然后比较了 this 和 other 两个对象是否相等,如果相等,返回 0;否则返回其他值。
阅读全文