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: @Override notations for member functions (e.g. onCreate on Android)


On 02/23/2014 01:31 PM, Marius Kjeldahl wrote:
(compiling KawaActivity.scm to net.kjeldahl.kawatest)
KawaActivity.scm:15:26: warning - no accessible method 'add' in
android.widget.LinearLayout

It seems to compile fine, but is there any way to get rid of that
warning when constructing the LinearLayout? I realize it's related to
"magic" of setting properties, but from the warning I am not sure if
it actually found the right "setOrientation" or not. If it did find
it, it really should shut up, right?

I'm guessing the problem is not the orientation:
but the 'tv' parameter.  That is needed to "add" children.

If you:
(require 'android-defs)
then that associates a ViewBuilder with android.view.View and so
ViewBuilder is used when compiling a build of a sub-class instance.
And ViewBuilder defines "addView" as a child-method-name, and so it
magically works.

As a hack the following will probably work:
    (LinearLayout (this)
                  orientation: LinearLayout:VERTICAL
                  view: tv)

though if you really want to show the "low-level" way of
doing it you can add an explicit addView call.

BTW, you might not realize you can replace:

 (define str (string-append "KawaActivity - "
                              ((tv:getText):toString)
                              " - "
                              ((Date):toString)))
   (tv:setText str)))

by the following (not tested ...):

   (tv:setText &{KawaActivity - &(tv:getText) - &(Date)})
--
	--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]