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]

Fwd: @Override notations for member functions (e.g. onCreate on Android)


My gmail skills are lacking, which is why I keep replying privately
instead of to the list. Shared with list for future reference.

Thanks,

Marius K.


---------- Forwarded message ----------
From: Marius Kjeldahl <marius.kjeldahl@gmail.com>
Date: Mon, Feb 24, 2014 at 5:37 PM
Subject: Re: @Override notations for member functions (e.g. onCreate on Android)
To: Per Bothner <per@bothner.com>


As always, you're spot on. I missed the fact that android-defs also
took care of the add-view magic. Also adding "view:tv" as you
suggested seems to work just fine.

Thanks,

Marius K.

On Mon, Feb 24, 2014 at 2:58 AM, Per Bothner <per@bothner.com> wrote:
> 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]