Important: Please read the Qt Code of Conduct -

Pass ContextWrapper to java by modifiying notification example for Android

  • Hello I'm trying to modify the notification sample provided with QT ( at \QT5.4.1\Examples\Qt-5.4\androidextras\notification ) in order to use application's ContextWrapper object.
    Here's an example of a code I have as reference ( no QT just a fragment of a pure java app).

    public class DemoApplication extends Application {

    public void onCreate() {
        GUIHelper.init(this); //  decalred as public static void init(ContextWrapper context)


    Now I need to do same thing but calling GUIHelper.init from inside of \QT5.4.1\Examples\Qt-5.4\androidextras\notification\android-sources\src\org\qtproject\example\notification\

    public class NotificationClient extends

    private static NotificationManager m_notificationManager;
    private static Notification.Builder m_builder;
    private static NotificationClient m_instance;
    private static EyeVerify _eyeverifier = null;
    public NotificationClient()
        m_instance = this;

    public static void notify(String s) {

    	// pass ContextWrapper here
    	GUIHelper.init( ??? );



    As notify method is invoked from the c++ side I don't know where to obtain the ContextWrapper ( or Application ) instance to pass to GUIHelper.init.

    Any help will be appreciated
    Thanks in advance

Log in to reply