               :on-click (fn [_] (show-picker activity
                                             (date-picker activity)))}]]
    [:button {:text "+ Event",
-             :on-click (fn [_] (add-event))}]
-   [:text-view {:text @listing,
+             :on-click (fn [_](add-event))}]
+   [:text-view {:text (format-listing @listing),
                 :id ::listing}]])
 
 (defn update-ui []
-  (set-elmt ::listing @listing)
+  (set-elmt ::listing (format-listing @listing))
   (set-elmt ::location "")
-  (set-elmt ::name ""))
-
+  (set-elmt ::name "")
+  (set-elmt ::date ""))
 
 (defactivity com.davidykay.helloclojure.MainActivity
   :key :main

    (on-ui
     (set-content-view! this
                        (main-layout this)))
    (on-ui
     (set-elmt ::listing @listing))))

(ns com.davidykay.helloclojure.main
  (:require [neko.log :as log])
  (:use [neko.activity :only [defactivity set-content-view!]]
        [neko.threading :only [on-ui]]
        [neko.ui :only [make-ui config]]
        [clojure.string :only [join]])
  (:import (java.util Calendar)
           (android.view View)
           (android.app Activity)
           (android.app DatePickerDialog DatePickerDialog$OnDateSetListener)
           (android.app DialogFragment)))

(def listing (atom (sorted-map)))

(declare ^android.widget.LinearLayout mylayout)
(declare update-ui)

(defn format-events [events]
  (->> (map (fn [[location event]]
              (format "%s - %s\n" location event))
            events)
       (join "                      ")))

(defn format-listing [lst]
  (->> (map (fn [[date events]]
               (format "%s - %s" date (format-events events)))
             lst)
       join))


(defn set-elmt [elmt s]
  (on-ui (config (elmt (.getTag mylayout)) :text s)))
