Simple Android app crashes when calling Button Method
Simple Android app crashes when calling Button Method
When you try to use the button method and test it on the android emulator, it always crashes. If you don't call any methods its work first, but you need to edit it when you program. A simple example is test1, if you comment out test1.getHeight() it works fine, but when you use it, it crashes. Ultimately, You want to be able to edit the height/width.
Solution :
You may be calling getHeight
too early.
Button
is populated after the View
is rendered, and your Button
is called before View
is rendered.
Try move your call, getHeight
around in different methods, other than onCreate
.
Comments
Post a Comment