I'm trying to call getSystemService
(method of Activity
) to access sensors, but looks like it doesn't exist.
Here's the code I tried:
(in-ns 'com....) ; Some Neko project
(.getSystemService a) ; a is :def of Activity
I even checked all the methods of a
with
(use '[clojure.reflect :as r])
(require '[clojure.pprint :only print-table])
(print-table (:members (r/reflect a)))
There was getSystemService
in a list.
But somehow I can't call it: Clojure says there's no such method.
UPDATE: getSystemService
is not a static method, so that's the reason, I guess.
But still, is there a way?
According to Activity
javadoc, Activity.getSystemService()
takes a String
argument. There is no overloaded method that takes no arguments. The message saying there is no such method means there is no method by that name that takes no arguments. Try calling getSystemService
with a String
argument, for example:
(.getSystemService a "window")