This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Android REPL - add* syntax-sugar not available in constructor


Here's the sources: 
http://www.redmountainsw.com/wordpress/files/2012/01/KawaHelo-0.1.zip (I'll
prepare an apk when I figure it out, and it'll be easier for other people to
experiment as well)

At the moment, I'm just getting initial pains with learning scheme and
android at the same time, but the potential reward of not having to redeploy
every time I make an alteration is too appealing.

I've had success connecting to emulator and device. 

Instructions: 

ant debug uninstall installd
adb shell start am -n kawa.android/kawa.android.hello
adb logcat

The IP address is displayed on the activity screen. If you are on emulator, 
then

  adb forward tcp:4444 tcp:4444
  telnet localhost 4444

otherwise, you should be able to telnet to port 4444 on the displayed IP
Address.

Then try the following

#|kawa:76|# (*activity*:run-on-ui-thread 
             (runnable 
               (lambda ()  
                 ((android.widget.Toast:makeText 
                     *activity* 
                     "Hello from REPL"
                     android.widget.Toast:LENGTH_LONG):show))

(*activity*:runOnUiThread
  (runnable
     (lambda ()
        (*activity*:setContentView
          (android.widget.TextView *activity* text: "Changed Content")))))

Unfortunately, I haven't figured out how to catch errors on the UI thread,
and don't have enough macro-fu to skip most of the boilerplate code.

Here's the troublesome expression that wouldn't run and wouldn't log on REPL

(*activity*:runOnUiThread
  (runnable
    (lambda ()
      (try-catch
        (*activity*:setContentView
          (android.widget.LinearLayout *activity
            orientation: android.widget.LinearLayout:VERTICAL
            view: (android.widget.TextView *activity* text: "Hello")))
        (e java.lang.Exception
          (android.util.Log:v "kawa-hello" e))))))

-- 
View this message in context: http://old.nabble.com/Android-REPL---add*-syntax-sugar-not-available-in-constructor-tp33222365p33223268.html
Sent from the Sourceware - kawa list mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]