I am trying to do a HTTP Post and as I came to know that time consuming tasks should be used within a Async Task or a Handler, I tried to code it using a Handler but I am getting an Handler uncaught exception, Unable to determine where I am going wrong. Below is my code and the log trace.
           @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button Bt = (Button)findViewById(R.id.button1);
    Button Btx = (Button)findViewById(R.id.button2);
    et = (EditText)findViewById(R.id.editText1);
    etp = (EditText)findViewById(R.id.editText2);
    Bt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog = ProgressDialog.show(MainActivity.this,"Loading", "Please Wait...");
            h = new Handler(){
                @Override
                public void handleMessage(Message msg) {
                    super.handleMessage(msg);
                    dialog.dismiss(); 
                }
            };
            new Thread(){
                @Override
                public void run() {
                    super.run();
                    Connection();
                    try {
                        Thread.sleep(3000);
                        h.sendEmptyMessage(0); 
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }.start();
        }
    });
   // Btx.setOnClickListener(Sig);
}
    private View.OnClickListener Sig =new View.OnClickListener() {
        public void onClick(View v){
            Intent Sign = new Intent(MainActivity.this,Signup.class);
            startActivity(Sign);
        }
        };
    public  void Connection(){
    String is = null;
    String X = et.getText().toString();
    String Y = etp.getText().toString();
    if(X.length()>0 && Y.length()>0){
        A = X;
        B = Y; 
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://animsinc.com/query.php"); 
        try {
           List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
           nameValuePairs.add(new BasicNameValuePair("username", X));
           nameValuePairs.add(new BasicNameValuePair("password",Y));
           httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
           httpclient.execute(httppost);
        //   et.setText(""); // clear text box
        //   etp.setText(""); // clear text box
        HttpResponse responce = httpclient.execute(httppost);
        HttpEntity entity = responce.getEntity();
        is = EntityUtils.toString(entity);
       // in = entity.getContent();
      //  Log.e("post responce----->", "" + is);
        Toast.makeText(this,""+is, Toast.LENGTH_LONG).show();
         } catch (ClientProtocolException e) {
             // TODO Auto-generated catch block
         }catch (UnsupportedEncodingException e) {
            e.printStackTrace();
         }catch (IOException e) {
             // TODO Auto-generated catch block
         }
    } else{
            // display message if text fields are empty
             Toast.makeText(getBaseContext(),"All field are required",Toast.LENGTH_SHORT).show();
         }
    if(is != null){
        Toast.makeText(this,""+is, Toast.LENGTH_LONG).show();
    }
}
}
This is my Log Cat:

 
    