   (set-elmt activity ::water "")
   (set-elmt activity ::muscle ""))
 
+
+(def logfile "test.csv")
+
+(defn write-logfile [activity t]
+  (let [file (File. (.getFilesDir activity) logfile)]
+    (do (when (not (.exists file))
+          (.createNewFile file))
+        (with-open [wrt (io/writer file)]
+          (.write wrt t)))))
+
+(defn read-logfile [activity]
+  (let [file (File. (.getFilesDir activity) logfile)]
+    (when (.exists file)
+      (with-open [rdr (io/reader file)]
+        (slurp rdr)))))
+
 (defn add-event [activity]
   (let [date-key (try
                    (read-string (get-elmt activity ::date))

             #(reduce (fn [l k] (assoc-in l [date-key k] (read-string (get-elmt activity k))))
                      %
                      [::date ::weight ::bf ::water ::muscle]))
      (update-ui activity))))

(defn date-picker [activity]

(defn show-picker [^Activity activity dp]
  (. dp show (. activity getFragmentManager) "datePicker"))


(defn main-layout [activity]
  [:linear-layout {:orientation :vertical}
