i am unable to connect android to servlet
===

here is my java code

  



     @SuppressLint({ "ParserError", "ParserError" })
      public class MainActivity extends Activity {

	 protected void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	      InputStream is=null;
	String result = "";
	TextView tv=(TextView)findViewById(R.id.tv);
	//the year data to send
	ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
	nameValuePairs.add(new BasicNameValuePair("name","shrey"));
	 
	//http post
	 try{
	        HttpClient httpclient = new DefaultHttpClient();
	        HttpPost httppost = new HttpPost("http://10.0.2.2:8081/onlinechat");
	      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
	        
	        HttpResponse response = httpclient.execute(httppost);
	        HttpEntity entity = response.getEntity();
	       is = entity.getContent();
	
	 }
	 catch (ClientProtocolException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	//convert response to string
	try{
		BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
	        StringBuilder sb = new StringBuilder();
	        String line = null;
	        while ((line = reader.readLine()) != null) {
	                sb.append(line + "\n");
	        }
	        is.close();
	 
	        result=sb.toString();
	        tv.setText(result);
	
	}catch(Exception e){
	        Log.e("log_tag", "Error converting result "+e.toString());
	}
	 
   	//parse json data
       /*	try{
	          JSONArray jArray = new JSONArray(result);
	        for(int i=0;i<jArray.length();i++){
	                JSONObject json_data = jArray.getJSONObject(i);
	                Log.i("log_tag" , "name: "+json_data.getString("user")
	                        
	                        
	                );
	        }
	
	}
	 catch (JSONException e)
	 {
	        Log.e("log_tag", "Error parsing data "+e.toString());
       }
    */
	
	 }
	
	
	 }
and here is my servlet code

      public class android extends HttpServlet {

    /**
     * Processes requests for both HTTP
     * <code>GET</code> and
     * <code>POST</code> methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
     protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
       String user=request.getParameter("name").toString();
     /* BufferedReader reader = new BufferedReader( new  InputStreamReader(request.getInputStream() ) );  
                      String res = reader.readLine();  
         while( null != res )  
                       {  
                                             System.out.println( res );  
                                res = reader.readLine();  
                        }  
                  
                      /*InputStream is = new        BufferedInputStream(request.getInputStream());      
            byte[] buf = new byte[8096]; 
                int bytesRead; 
                System.out.println("readbuf "+ is.read( buf )); 
                                    while( ( bytesRead = is.read( buf ) ) != -1 )  
                    os.write( buf, 0, bytesRead );  */  
        
        
        
        out.print("welcome"+user);
        out.println("success");
   
    
    
    
     }

      // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP
     * <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
      @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
          processRequest(request, response);
         }

    /**
     * Handles the HTTP
     * <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
       @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
         processRequest(request, response);
       }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
       @Override
      public String getServletInfo() {
          return "Short description";
       }// </editor-fold>
        }
i have added internet permission in my manifest also but still it doesnt run here is my logcat after debugger settles
    07-31 13:45:50.874: E/log_tag(666): Error converting result java.lang.NullPointerException
