Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #31230 > unrolled thread

Toasts on Android?

Started byJulian Fondren <ayrnieu@gmail.com>
First post2014-06-05 15:37 -0700
Last post2014-06-06 01:45 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.forth


Contents

  Toasts on Android? Julian Fondren <ayrnieu@gmail.com> - 2014-06-05 15:37 -0700
    Re: Toasts on Android? Bernd Paysan <bernd.paysan@gmx.de> - 2014-06-06 01:45 +0200

#31230 — Toasts on Android?

FromJulian Fondren <ayrnieu@gmail.com>
Date2014-06-05 15:37 -0700
SubjectToasts on Android?
Message-ID<7ef40f6c-4ad1-4d9e-b9cf-be3e3e2a2115@googlegroups.com>
Hello clf,

I'm stumped.  I thought it would be a convenient thing to put out some
android Toasts for debugging purposes, but I've had to write to a file
instead.

I'd gotten this far:

  require jni-helper.fs
  also jni

  jni-class: android/widget/Toast
  jni-static: Toast.makeText makeText (Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
  jni-method: Toast.show show ()V

  : toast ( c-addr u -- )
    cstring $0! make-jstring  \ js"
    clazz swap 0 Toast.makeText >o Toast.show o> ;

But TOAST throws a Java exception at Toast.makeText .  I don't know the
Java exception it throws - it seems that the message should be printed
to gfortherr.log, but it doesn't make it.  I assume that Toast.makeText
is either unhappy with its arguments or is unhappy with the thread that
it's running under.  I've exhausted alternative arguments; I don't know
how to give it other threads to run with.

Here's a word that more readily fails where TOAST does:
  
  : toasty clazz js" eureka" 0 Toast.makeText ;

Has anyone toasts to work under gforth on Android?

It's not a pressing matter for me.  Just something I expected to be
easy, that wasn't.


-- Julian

[toc] | [next] | [standalone]


#31232

FromBernd Paysan <bernd.paysan@gmx.de>
Date2014-06-06 01:45 +0200
Message-ID<lmqveg$3cn$1@online.de>
In reply to#31230
Julian Fondren wrote:

> Hello clf,
> 
> I'm stumped.  I thought it would be a convenient thing to put out some
> android Toasts for debugging purposes, but I've had to write to a file
> instead.
> 
> I'd gotten this far:
> 
>   require jni-helper.fs
>   also jni
> 
>   jni-class: android/widget/Toast
>   jni-static: Toast.makeText makeText
>   
(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
>   jni-method: Toast.show show ()V
> 
>   : toast ( c-addr u -- )
>     cstring $0! make-jstring  \ js"
>     clazz swap 0 Toast.makeText >o Toast.show o> ;
> 
> But TOAST throws a Java exception at Toast.makeText .  I don't know the
> Java exception it throws - it seems that the message should be printed
> to gfortherr.log, but it doesn't make it.  I assume that Toast.makeText
> is either unhappy with its arguments or is unhappy with the thread that
> it's running under.  I've exhausted alternative arguments; I don't know
> how to give it other threads to run with.
> 
> Here's a word that more readily fails where TOAST does:
>   
>   : toasty clazz js" eureka" 0 Toast.makeText ;
> 
> Has anyone toasts to work under gforth on Android?
> 
> It's not a pressing matter for me.  Just something I expected to be
> easy, that wasn't.

I suppose it doesn't like the thread you are calling it from.  I didn't have 
success with the unpacking spinner from the Gforth task either, so the 
spinner now posts a message to the original Java task, which then creates 
the spinner widget.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web