Code example for Formatter

Methods: format, toString

0
	 */ 
	protected boolean upload(HappyBottle b) {
		//so we set up the request 
		HttpPost request = new HttpPost();
		Object[] values = {b.getEmo(), b.getLat(), b.getLong(), b.getMsg(), b.getUID(), b.getTime()};  
		Formatter f = new Formatter();
		//we input all the information here 
		f.format("bottle[emo]=%s&bottle[lat]=%s&bottle[long]=%s&bottle[msg]=%s&bottle[user_id]=%s&bottle[time]=%s&commit=Create Bottle", values);
		String data = f.toString();
 
		URI url;
		try {  
			url = new URI("http", "happytrack.heroku.com", "/bottles", data, null);
			//here we add the data to the url (POST) and then of course send it to connectionhelper to do all the heavy lifting  
			request.setURI(url);
			Log.d(TAG, "data: "+ data);
			Log.d(TAG, "uRL: " + url);
		} catch (URISyntaxException e1) {
 
			e1.printStackTrace();
		}