Back to project page amulet.
The source code is released under:
MIT License
If you think the Android project amulet listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package scamell.michael.amulet; //from ww w .j ava 2s .c o m import android.util.Log; import org.json.JSONObject; public class DrinkDiaryEntry { protected String date, drinkName, drinkType, units; protected Boolean isSelected = false; public DrinkDiaryEntry() { //default constructor } public DrinkDiaryEntry(String mTimeStamp, String mDrinkName, String mDrinkType, String mUnits) { date = mTimeStamp; drinkName = mDrinkName; drinkType = mDrinkType; units = mUnits; } public DrinkDiaryEntry(JSONObject jsonObject) { try { date = jsonObject.getString("date"); String s = jsonObject.getString("drinkName"); int dashPos = s.indexOf("-"); drinkName = s.substring(0, dashPos - 1); drinkType = s.substring(dashPos + 2, s.length()); units = jsonObject.getString("units"); } catch (Exception e) { Log.e("ERROR_DRINK_DIARY_OBJECT", "Couldn't create object from JSONObject"); e.printStackTrace(); } } }