title: Sending message to a Handler on a dead thread Error while calling Mysql connection
body: <p>i have called a method which is connecting to Mysql for uploading data and getting this error. I tried new Thread also but no benefit. I read many similar questions mostly related to Toast a message. Can u advice how to handle it. Method is called onHandleintent of class extending to IntentService.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class LocalService extends IntentService {
  
  
      public LocalService() {
          super("LocalService");
      }
  
      double sal;
      double var;
      int deviceid = 20;
  
  
      private String datepattern = "dd-MMM-yyyy";
      String date = new SimpleDateFormat(datepattern).format(new Date());
      String timepat = "hh-mm-ss aa";
      String time = new SimpleDateFormat(timepat).format(new Date());
  
      @Override
      protected void onHandleIntent(Intent intent) {
  
              new Thread(new Runnable() {
                  @Override
                  public void run() {
                      uploadtoserver();
                  }
              }).start();
  
          } 
      }
  </code></pre>