calling method from another activity android -


i have methods in class, mainactivity, want move class clean bit.

when call method mainactivity works perfectly. when call other class, mainactivity2, java.lang.nullpointerexception

here how calling mainactivity: mainactivity2 ma = new mainactivity2(); ma.onlongclick();

my mainactivity2 extends mainactivity

sorry stupid questions, confused why having problem thought knew how call methods other classes...

this works me:

  • mainactivity2 doesn't extend mainactivity
  • i use following code: new mainactivity2().onlongclick();

try , tell if works ;)


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -