I try to call a method from another class, but I get an exception error.
I have two classes, and class 1 is the main class
Class 1 has an onclick method that calls a method from another onclick class.
I have text fields and edittexts declared in class 1.
Class 2 has functionality for these and uses if statements.
I am extending class 1 from class 2, so class 2 uses variables.
In what ways can I call methods from other classes in android.
Right now, I'm just calling a method from class 2 in class 1, using:
class1.method();
but this does not seem to work. Appreciate any advice.
Edit:
Now I created a variable in class 1:
static class2 object;
from this i call onclick :
object.class2method();
I get a nullPointerexception error message.
android oop
Tommy
source share