Code example for Formatter

Methods: formattoString

	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", "", "/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  
			Log.d(TAG, "data: "+ data);
			Log.d(TAG, "uRL: " + url);
		} catch (URISyntaxException e1) {
Stop searching for code, let great code find you!  Add Codota to your java IDE