unfortunately android application has been stooped. At Heep Post while attemting to call server : unfortunately android application has been stooped. At Http Post while attempting to call server at post activity please help



HttpClient cli = new DefaultHttpClient();
            	//HttpPost post = new HttpPost("http://" + sp.getString("ip", "localhost") + "/attendance/cliLogin.php");
            	
            	HttpPost post = new HttpPost("localhost/attendance/");
            	
            	// seting post data
            	List<NameValuePair> loginData = new ArrayList<NameValuePair>(2);
            	loginData.add(new BasicNameValuePair("uname", uname));
            	loginData.add(new BasicNameValuePair("pass", pass));
            	post.setEntity(new UrlEncodedFormEntity(loginData));
            	
            	// executing login
            	HttpResponse res = cli.execute(post);
            	             HttpEntity resent = res.getEntity();

            	            	String result = EntityUtils.toString(resent);
            		
  
            	// reading response

            	if(result.equals("NoParams"))
            		Commons.showToast("Something went wrong", true);
            	else if(result.equals("Login"))
            	{
            		navi = new Intent(this, HomeActivity.class);
            		startActivity(navi);
            	}
            	else
            		Commons.showToast(result, true);
        	}
        	catch (HttpHostConnectException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				Commons.showToast("Can't reach server, check the Hostname", true);
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        }
        else
        	Commons.showToast("Username/Password can't be empty", true);
	}
}