I am trying 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<
I know this is a little bit late, but having spent 2 full days to find a solution, this one definitely works for me, that could be useful to others:
Define the required function within first class (MainActivity which extends Activity) as a Static:
public static int getScreenH(){
Integer H = Sheight;
return H;
}
Then in the other class (class ResizeTextView extends TextView) call the function:
Integer hh = MainActivity.getScreenH();
That's it!! The problem was that the calling class was an extension of TextView so none of the methods available within Activity could be used!