gpt4 book ai didi

java - 无法比较类型错误 : Object and int in Telegram

转载 作者:行者123 更新时间:2023-12-01 10:58:26 24 4
gpt4 key购买 nike

我导入了Telegram存储库。并尝试运行该项目,但在 Passcodeview.java 文件中出现上述错误。它显示了此代码 fragment 中的错误

 @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
View rootView = getRootView();
int usableViewHeight = rootView.getHeight() - AndroidUtilities.statusBarHeight - AndroidUtilities.getViewInset(rootView);
getWindowVisibleDisplayFrame(rect);
keyboardHeight = usableViewHeight - (rect.bottom - rect.top);

if (UserConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) {
int t = 0;
if (passwordFrameLayout.getTag() != 0) {
t = (Integer) passwordFrameLayout.getTag();
}
LayoutParams layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams();
layoutParams.topMargin = t + layoutParams.height - keyboardHeight / 2 - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
passwordFrameLayout.setLayoutParams(layoutParams);
}

super.onLayout(changed, left, top, right, bottom);
}

虽然同一个项目在我的另一台机器上正确运行一次,但我没有更改任何内容。

最佳答案

问题出在线上:if (passwordFrameLayout.getTag() != 0) {

getTag() 返回一个对象,不能将其与整数常量进行比较。相反,您应该检查标签是否不为空。如果您不确定标记始终是 Integer,您也应该检查 instanceof:

if (passwordFrameLayout.getTag() != null && passwordFrameLayout.getTag() instanceof Integer) {

关于java - 无法比较类型错误 : Object and int in Telegram,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33473979/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com