Android : calling method from another activity android

on Wednesday, April 1, 2015


I have methods in a class, MainActivity, that I want to move to another class to clean up a bit.


When I call this method from mainactivity it works perfectly. When I call it from the other class, mainactivity2, I get java.lang.NullPointerException


Here is how I am calling it from MainActivity: MainActivity2 ma = new MainActivity2(); ma.onLongClick();


My MainActivity2 extends MainActivity


Sorry for the stupid questions, but I am confused as to why I am having this problem as I thought I knew how to call methods from other classes...


0 comments:

Post a Comment