Frontend

To ensure a high user acceptance, we use the LiveCards and Immersions given by the Glass Development Kit. Our IDE is partially the current version of Android Studio, as well as older versions due to restricted functions within the contemporary software (Issues in new Studio version regarding GDK).

Driven by Android Acitivities and navigational Intents, we parse JSON-objects between front- and backend.

Here we see an example of requesting the JSON from our Parser-Class

JSONObject json = jParser.makeHttpRequest(url_all_medicine, "GET", params);

After we have the object, we can loop through to get all medicine entries

medicine = json.getJSONArray(TAG_OBJECTS);
for (int i = 0; i < medicine.length(); i++) {
JSONObject c = medicine.getJSONObject(i); 

Let’s get the JSON-values to store them in our local variables

String id = c.getString(TAG_MID);
String name = c.getString(TAG_NAME);
String dose = c.getString(TAG_DOSE);
String type = c.getString(TAG_TYPE);
String image = c.getString(TAG_IMAGE);

Creating a new hashmap helps us, to collect all attributes of our medicine database entry

HashMap<String, String> map = new HashMap<String, String>();

Each childnode has to be manually added to the map, before we can add it to the ArrayList

map.put(TAG_MID, id);
map.put(TAG_NAME, name);
map.put(TAG_DOSE, dose);
map.put(TAG_TYPE, type);
map.put(TAG_IMAGE, image);

medicineList.add(map);