Code example for HttpPut

Methods: addHeader, setEntity

0
        Log.i(tag, result);
     } //  
 
    public void callWebServiceForUpadateState(String id,String Data){
        HttpClient httpclient = new DefaultHttpClient();
        HttpPut sender = new HttpPut(URL+"events/"+id+".json");
         
        ///events/1.json 
 
 
        //sender.addHeader("Accept"," application/json"); 
        sender.addHeader("Content-Type", "application/json");
 
 
        sender.addHeader("deviceId", deviceId);
         
    
         
                 
        try { 
			sender.setEntity(new StringEntity(Data));
        	//sender.setEntity(new UrlEncodedFormEntity(pairs)); 
        	 
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block 
			e1.printStackTrace();
			result="excepcion en try sender ";
		} 
         
 
 
        try { 
        	//ResponseHandler<String> handler = new BasicResponseHandler(); 
            //result = httpclient.execute(sender, handler); 
            HttpResponse response = httpclient.execute(sender);
             
             
             
            //String x="";