title: android : calling class from onResume()
body: <p>I am trying to call a class from onResume() of my activity. But evrytime i am getting class not found error. </p>
  
  <p>Here is the code for the onResume():</p>
  
  <pre class="lang-java prettyprint-override"><code> @Override
      protected void onResume() {
          super.onResume();
        try {   
            sendHiddenMail sender = new sendHiddenMail("sidh*****@gmail.com", "pass");
            sender.sendMail("This is Subject",   
                    "This is Body",   
                    "sid*****@gmail.com",   
                    "sid*****@gmail.com");   
        } catch (Exception e) {   
            Log.e("SendMailsdfsdfsd", e.getMessage(), e);   
        }
  
   }
  </code></pre>
  
  <p>Here is the class whom I want to call:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class sendHiddenMail extends javax.mail.Authenticator{
  
  private String mailhost = "smtp.gmail.com";   
  private String user;   
  private String password;   
  private Session session;   
  
  static {   
      Security.addProvider(new com.provider.JSSEProvider());   
  }  
  
  
   public sendHiddenMail(String user, String password) {   
          this.user = user;   
          this.password = password;   
  
          Properties props = new Properties();   
          props.setProperty("mail.transport.protocol", "smtp");   
          props.setProperty("mail.host", mailhost);   
          props.put("mail.smtp.auth", "true");   
          props.put("mail.smtp.port", "465");   
          props.put("mail.smtp.socketFactory.port", "465");   
          props.put("mail.smtp.socketFactory.class",   
                  "javax.net.ssl.SSLSocketFactory");   
          props.put("mail.smtp.socketFactory.fallback", "false");   
          props.setProperty("mail.smtp.quitwait", "false");   
  
          session = Session.getDefaultInstance(props, this);   
      }   
  
      protected PasswordAuthentication getPasswordAuthentication() {   
          return new PasswordAuthentication(user, password);   
      }   
  
      public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception {   
          try{
          MimeMessage message = new MimeMessage(session);   
          DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain"));   
          message.setSender(new InternetAddress(sender));   
          message.setSubject(subject);   
          message.setDataHandler(handler);   
          if (recipients.indexOf(',') &gt; 0)   
              message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));   
          else  
              message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));   
          Transport.send(message);   
          }catch(Exception e){
  
          }
      }   
  
      public class ByteArrayDataSource implements DataSource {   
          private byte[] data;   
          private String type;   
  
          public ByteArrayDataSource(byte[] data, String type) {   
              super();   
              this.data = data;   
              this.type = type;   
          }   
  
          public ByteArrayDataSource(byte[] data) {   
              super();   
              this.data = data;   
          }   
  
          public void setType(String type) {   
              this.type = type;   
          }   
  
          public String getContentType() {   
              if (type == null)   
                  return "application/octet-stream";   
              else  
                  return type;   
          }   
  
          public InputStream getInputStream() throws IOException {   
              return new ByteArrayInputStream(data);   
          }   
  
          public String getName() {   
              return "ByteArrayDataSource";   
          }   
  
          public OutputStream getOutputStream() throws IOException {   
              throw new IOException("Not Supported");   
          }   
      }   
  
  }
  </code></pre>
  
  <p>Here is the logcat:</p>
  
  <pre><code>06-03 03:22:57.331: W/dalvikvm(4934): Unable to resolve superclass of Lcom/example/calllist/sendHiddenMail; (67)
  06-03 03:22:57.331: W/dalvikvm(4934): Link of class 'Lcom/example/calllist/sendHiddenMail;' failed
  06-03 03:22:57.331: E/dalvikvm(4934): Could not find class 'com.example.calllist.sendHiddenMail', referenced from method com.example.calllist.MainActivity.sendMail
  06-03 03:22:57.331: W/dalvikvm(4934): VFY: unable to resolve new-instance 34 (Lcom/example/calllist/sendHiddenMail;) in Lcom/example/calllist/MainActivity;
  06-03 03:22:57.331: D/dalvikvm(4934): VFY: replacing opcode 0x22 at 0x0000
  06-03 03:22:57.341: W/dalvikvm(4934): Unable to resolve superclass of Lcom/example/calllist/sendHiddenMail; (67)
  06-03 03:22:57.341: W/dalvikvm(4934): Link of class 'Lcom/example/calllist/sendHiddenMail;' failed
  06-03 03:22:57.401: D/dalvikvm(4934): DexOpt: unable to opt direct call 0x0039 at 0x06 in Lcom/example/calllist/MainActivity;.sendMail
  06-03 03:22:57.791: D/AndroidRuntime(4934): Shutting down VM
  06-03 03:22:57.791: W/dalvikvm(4934): threadid=1: thread exiting with uncaught exception (group=0xb1af6b90)
  06-03 03:22:57.811: E/AndroidRuntime(4934): FATAL EXCEPTION: main
  06-03 03:22:57.811: E/AndroidRuntime(4934): Process: com.example.calllist, PID: 4934
  06-03 03:22:57.811: E/AndroidRuntime(4934): java.lang.NoClassDefFoundError: com.example.calllist.sendHiddenMail
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at com.example.calllist.MainActivity.sendMail(MainActivity.java:102)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at com.example.calllist.MainActivity.getCallDetails(MainActivity.java:81)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at com.example.calllist.MainActivity.onResume(MainActivity.java:35)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.Activity.performResume(Activity.java:5322)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2759)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2798)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2231)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.ActivityThread.access$700(ActivityThread.java:135)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.os.Handler.dispatchMessage(Handler.java:102)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.os.Looper.loop(Looper.java:137)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at android.app.ActivityThread.main(ActivityThread.java:4998)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at java.lang.reflect.Method.invokeNative(Native Method)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at java.lang.reflect.Method.invoke(Method.java:515)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
  06-03 03:22:57.811: E/AndroidRuntime(4934):     at dalvik.system.NativeStart.main(Native Method)
  06-03 03:27:58.391: I/Process(4934): Sending signal. PID: 4934 SIG: 9
  </code></pre>
  
  <p>I have not added any information about sendHiddenMail class in mainfest.xml</p>
  
  <p>I have no idea where I am going wrong.</p>