java - object oriented programming in android -
    i want use method in 1 of classes in class , code doesn't have error when run project "unfortunately project *  hast stopped" error. , when copy method instead of creating object , on run program without problem , can 1 tell me may problem ?   public void onclick(view arg0) {      string p = "+989357835774";     string m = "test";     sendsms sms = new sendsms();     sms.sms(p, m); }   public class sendsms extends activity {      public void sms (string phonno , string message){         pendingintent pi = pendingintent.getactivity(this, 0,             new intent(this, sendsms.class), 0);                         smsmanager sms = smsmanager.getdefault();         sms.sendtextmessage(phonno, "+9891100500", message , pi, null);       } }   these errors  :   08-23 19:31:00.065: e/androidruntime(9985): fatal exception: main 08-23 19:31:00.065: e/androidruntime(9985): java.lang.nullpointerexception 08-23 19:31:00.065: e/androidruntime(9985):     ...