Answer the question
In order to leave comments, you need to log in
How to change a variable in the class of another file by clicking on the button?
Here is the code from the first file
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
sub1 = (Button) view.findViewById(R.id.sub_tav);
sub2 = (Button) view.findViewById(R.id.sub_kop);
sub1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getActivity(),"Подписка на магаз1 офромлена успешно!",Toast.LENGTH_SHORT).show();
App.getInstance(true);
}
});
import android.app.Application;
public class App extends Application {
public static boolean isActive = false;
public static boolean getInstance(boolean b) {
b = false;
return b;
}
public boolean getActive(boolean b) {
return isActive;
}
public void setisActive(boolean _isActive) {
this.isActive= _isActive;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question