gpt4 book ai didi

java - 如何从 Java 类中的函数访问主类对象?

转载 作者:搜寻专家 更新时间:2023-10-31 19:53:31 25 4
gpt4 key购买 nike

<分区>

请阅读以下代码中的2条注释。

public class Field extends LinearLayout {
public void init() {
setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {

// I want to access the main object 'Field' here(not the class, the object)
}
});

// to be clear the object referred as 'this' from HERE should be accessed from where the above comment is.
}
}

这可能吗?是否有从对象内部的函数访问主类对象的关键字?

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