2014-07-23 2 views
1

Neko에 대한 자습서를 시작했고 필자는 고유 한 특성을 만들고 싶었습니다. 나는 here으로 설명 된 neko에 대한 문서를 따라 왔지만 오류가 계속 발생합니다.Neko에서 NoSuchMethodException을 생성하는 중계 함

더 구체적으로 :

; Clojure code 

(ns main 
    (:use [neko.activity :only [defactivity set-content-view!]] 
     [neko.threading :only [on-ui]] 
     [neko.ui :only [make-ui config]] 
     [neko.ui.traits :only [deftrait]])) 

(deftrait :on-text-change 
    {:attributes [:on-text-change]} 
    [^android.widget.TextView wdg, {:keys [on-text-change]}, opts] 
    (.addTextChangedListener wdg (reify android.text.TextWatcher 
           (afterTextChanged [this _]) 
           (beforeTextChanged [this _ _ _ _]) 
           (onTextChanged [this, s, start, before, count] 
            (on-text-change (.toString s) start before count))))) 

(declare ^android.widget.LinearLayout mylayout) 

(def main-layout [:linear-layout {:orientation :vertical, :id-holder true} 
        [:edit-text {:hint "Event name" :id ::name :on-text-change (fn [text _ _ _])}] 
        [:edit-text {:hint "Event location" :id ::location}]]) 

(defactivity MainActivity 
    :def a 
    :on-create 
    (fn [this bundle] 
    (on-ui 
    (set-content-view! a 
     (make-ui main-layout))))) 

제작 오류 :

java.lang.NoSuchMethodException : 주 $ eval1159 $ fn__160.invoke에서) $ fn__153 주요 인수에 대한 방법 .SetOnTextChange을 찾을 수 없습니다 (NO_SOURCE_FILE : 4)

아무도 비슷한 문제가 있거나 잘못된 생각을 갖고 있습니까? 미리 제안 해 주셔서 감사합니다.

답변

1

특성 정의 후에도 위젯 유형에 등록해야한다는 점을 잊어 버렸습니다.

(neko.ui.mapping/add-trait! :edit-text :on-text-change) 

지적 해 주셔서 감사합니다. 이제 문서를 업데이트 할 것입니다.

+0

신속하고 완벽한 답변을 보내 주셔서 감사합니다. 그것은 트릭을했다. – Nathan

관련 문제