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: Kawa on Android - problems with setting text properties using "text:"


Sorry I didn't answer this before.

On 03/09/2011 07:57 AM, Benny Tsai wrote:
However, I could use some help with an issue.  When compiling (using
"ant debug") the following "Hello World" code (as described here:
http://per.bothner.com/blog/2010/AndroidHelloScheme/):

(require 'android-defs)
(activity hello
   (on-create-view
    (android.widget.TextView (this)
     text:
     "Hello, Android from Kawa Scheme!")))

... the compilation fails with the following error:

[java] c:\Android\KawaHello\src\kawa\android\hello.scm:6:5: type
constant-string is incompatible with required type int

Line 6 is where I pass in the "Hello..." string to "text:".  I've read
that "text:" directs the compiler to look for "setText" and "addText"
methods.  Looking at the TextView API, I see that there are multiple
setText() methods, the first of which is setText(int resid).  Is the
compiler matching on that, and therefore expecting an int arg instead
of a String arg to "text:"?

The compiler tried to find the best match, using an approximation of the Java algorithm. In this case, it selects: android.widget.TextView.setText(java.lang.CharSequence)void

This is extra puzzling to me because I've read Peter Feigl's recent
messages about Kawa on Android, and his test activity code appears to
use "text:" with Strings with no problems.

Likewise ...


Here are some information on my environment.  Please let me know if
any additional info is needed.

Windows XP (SP3)
Sun JDK 1.6.0_24
Ant 1.8.2
Kawa 1.11, source from SVN trunk, revision 6919, compiled with "ant
-Denable-android=true"
Android SDK Tools, revision 10
Android SDK Platform-tools, revision 3
SDK Platform Android 2.2, API 8, revision 2 (also tried targeting
Android 2.3.3, API 10, revision 1, same problem occurs)

I'm testing on Fedora GNU/Linux, using Java 1.6.0_24-b07, SVN sources compiled with ant -Denable-android=true, ANDROID_PLATFORM=android-8, Android SDK Tools Revision 6 Project Target: Android 2.2. -- --Per Bothner per@bothner.com http://per.bothner.com/


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