[Interest] [ Android ] How pass argument to QtActivity::runOnUiThread ?

Eddie Sutton eddie.of.the.spam at gmail.com
Wed Sep 28 19:23:42 CEST 2016


How can you pass an argument to QtActivity runOnUiThread ?


Example with no argument:

    public void hide()
    {
        m_activity.runOnUiThread( new Runnable() {
            @Override
            public void run() {
                if (m_dialog != null && m_dialog.isShowing())
                    m_dialog.dismiss();
                reset();
            }
        });
    }



My goal is to temporarily disable power saving during a log-running Bluetooth transfer by clearing the Window flag FLAG_KEEP_SCREEN_ON

    public void setKeepScreenOn(boolean keepScreenOn)

    {
        m_activity.runOnUiThread( new Runnable() {
            @Override
            public void run() {


            if (keepScreenOn) {

                m_instance.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

                return;

            }



            // Else let it go back to sleep and save power

            m_instance.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

            }
        });
    }



-Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160928/664e1a19/attachment.html>


More information about the Interest mailing list