5
Lütfen aşağıdaki koddaki 2 yorumu okuyun.Ana sınıf nesnesine, Java'daki sınıftaki bir işlevden nasıl erişebilirim?
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.
}
}
Bu mümkün mü? Nesnenin içindeki bir işlevden ana sınıf nesnesine erişmek için bir anahtar kelime var mı?
Üzgünüm, iç sınıfın ve dış sınıftaki şeyin bundan farklı olduğunu düşündüm. – SadeepDarshana