passing Context into Application?

Richard Bair richard.bair at
Mon Feb 24 01:10:29 PST 2014

That seems quite reasonable to me.

On Feb 24, 2014, at 10:06 AM, tomas.brandalik <tomas.brandalik at> wrote:

> Another way to get context would be from glass but I also prefer having another launch method on Application.
> -Tomas
> On 02/24/2014 09:52 AM, Tom Schindl wrote:
>> Maybe some code makes that more clear.
>> See
>> If I got Johan right he'd like to have an additional Application.lauch
>> method with takes a context
>> Application.launch(Class<? extends Application> clazz, Object
>> applicationContext, String... args)
>> and then on Application a method named getApplicationContext() : Object
>> to retrieve the passed in value.
>> Tom
>> On 24.02.14 09:47, Tom Schindl wrote:
>>> The problem is that the instance is created by Application.launch and
>>> this call returns only when the application is stopped!
>>> Tom
>>> 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