In my mainactivity I have the following snip
MainActivity.class
private Button btnx10;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button btnx10=(Button)findViewById(R.id.MainCOPbtn);
DrawLines();
}
private void drawLines(){
float centerYOnImage1=btnx10.getHeight()/2;
}
I'm trying to access the button that is created in the onCreate()
method from the method drawLines()
i.e. in the same class MainActivity.class
but outside of this method.
When I am trying to access the button in the drawlines()
method it's value is null.
How can I access the button?