Code example for StringEntity

Methods: setContentEncoding

0
			Gson gson 					= new Gson();
			HttpPost post 				= new HttpPost("/PositionLog");
			HttpAuthorizedRequest req 	= ((NaSpotkanieApplication)getApplication()).getHttAuthorizedRequest();
 
			try { 
				StringEntity s = new StringEntity(gson.toJson(positions[0]));
				s.setContentEncoding("application/json");
				post.setEntity(s);
				 
				req.makeRequest(post);
				return Boolean.TRUE;
			} catch (Exception e) {
				e.printStackTrace();
				return Boolean.FALSE;
			}  
		} 
		 
		protected void onPostExecute(Boolean result) {			
			if(result == Boolean.FALSE) {
				Toast.makeText(TrackingManager.this, "Unable to update position", Toast.LENGTH_LONG);
				return;