As a image, I'm making app using fragment.
I want when btn1 is clicked, btn2 is disabled.
Here are codes Aclass.JAVA
mBtn1 = (Button) myView.findViewById(R.id.button1);
mStartBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View myView) {
BClass.button2.setEnabled(false);
}
}
});
Bclass.JAVA
public static Button mBtn2;
mBtn2 = (Button) findViewById(R.id.button2);
There is similar question
Access a button from another class in android
But it makes function and i don't get it.
How can i solve this problem?
********** edited *************
When i click btn1
There is an error
Attempt to invoke virtual method 'void android.widget.Button.setEnabled(boolean)' on a null object reference.
I want to solve this problem