Android ListViev Tutorial on Android dev in Clojure.
Follow the tutorial and the build instructions from Sattvik's Neko.
Replace the Java code with
( ns net.thomas.android.clojure.HelloListView (:gen-class :extends android.app.ListActivity :exposes-methods {onCreate superOnCreate}) (:import android.util.Log) (def STRINGS ["String1" "String2" "String3"]) (defn -onCreate [this bundle] (.superOnCreate this bundle ) (let [aa (android.widget.ArrayAdapter. this net.thomas.android.clojure.R$layout/list_item STRINGS)] (.setListAdapter this aa) (let [lv (.getListView this)] (.setTextFilterEnabled lv true) (.setOnItemClickListener lv (proxy [android.widget.AdapterView$OnItemClickListener] [] (onItemClick [parent view position id] (Log/d "CLOJURE" "CLICKED" )) )) )))Use adb logcat and you should see the message when an item is clicked.
No comments:
Post a Comment