passing Context into Application?

Tom Schindl tom.schindl at
Mon Feb 24 00:47:41 PST 2014

The problem is that the instance is created by Application.launch and
this call returns only when the application is stopped!


On 24.02.14 09:45, Richard Bair wrote:
> What if you had an AndroidApplication extends Application that added the new APIs, such that somebody could specialize behave by using the AndroidApplication subclass?
> On Feb 24, 2014, at 9:03 AM, Johan Vos <johan at> wrote:
>> I've been working on using the Android API's in a JavaFX application. As
>> explained in my blog post at
>> we're
>> using a (imo) rather dirty trick.
>> The problem is that all Android API's need to be accessed via a Context
>> instance. The Java FXActivity that we use to bootstrap the JavaFX
>> Application extends Context, but it is only accessible in the JavaFX app
>> since we add it as a static field on FXActivity. When FXActivity calls the
>> LauncherImpl to start the application, we can't pass context information.
>> We can pass String[] but that is not useful here.
>> In general, I think the environment that launches a JavaFX Application
>> (Android, iOS, script, JNLP, management software,...) may want to pass some
>> context information. Of course this context information is very specific,
>> with Object being the ugly common denominator.
>> I realize it goes against the wora principles, but having the possibility
>> to either inject or set a context on javafx.application.Application would
>> definitely help using JavaFX in other environments.
>> - Johan

More information about the openjfx-dev mailing list