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


Groups > comp.lang.forth > #31232

Re: Toasts on Android?

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: Toasts on Android?
Date 2014-06-06 01:45 +0200
Organization 1&1 Internet AG
Message-ID <lmqveg$3cn$1@online.de> (permalink)
References <7ef40f6c-4ad1-4d9e-b9cf-be3e3e2a2115@googlegroups.com>

Show all headers | View raw


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/

Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web