but the buttonRegister returns null and the app crashes, can anybody tell me where have I gone wrong,
i don't see where you are calling
setContentView(<layout>);
method. Without it, it always returns NPE
because this method cares about inicialisation of all UI instances in specified layout. You have to call it always before you want to initialise widgets with
findViewById(<id>);
Since you are calling it in another class it won't work (class know nothing about what you did in other class). You need to:
- pass widgets via some constructor
- change application logic (most likely is not designated correctly)