Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
newbie100
Posts: 105
Registered: ‎05-22-2008

UiEngine.queueStatus problem when device is locked

Hi,

 

I am displaying notification screens using UiEngine.queueStatus().

 

When the device is not locked, all works fine.

 

When the device is locked, after I unlock it (enter password or key combo), the screen seems to freeze.

Hitting back or moving the rollerball seems to get the screen to refresh....

 

Has anyone else faced this problem with OS 4.2 on 8100 / 8800 ?

 

Thanks 

 

Please use plain text.
Developer
kzettel
Posts: 120
Registered: ‎07-16-2008

Re: UiEngine.queueStatus problem when device is locked

Is this on an actual device or the simulator?
Kurt Zettel | Chief Architect | Metova
www.metova.com
Please use plain text.
Developer
newbie100
Posts: 105
Registered: ‎05-22-2008

Re: UiEngine.queueStatus problem when device is locked

Its on the actual device.

 

Its very annoying for the end user, as they seem to think the entire device is frozen !!

 

But moving the trackball around or simply hitting the back key refreshes the screen, and shows the popup

dialog that I pushed using the queue method I used.

 

Thx

Please use plain text.
Administrator
MSohm
Posts: 14,073
Registered: ‎07-09-2008
My Carrier: Bell

Re: UiEngine.queueStatus problem when device is locked

From where are displaying the screen from (application running in the background, a particular listener, etc...)?  Can you provide a code snippet?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
newbie100
Posts: 105
Registered: ‎05-22-2008

Re: UiEngine.queueStatus problem when device is locked

 

The screen is being pushed ONLY while the application is in the background.

 

 

This code snippit is launched from within a Thread, that always runs periodically.

It is kicked off from the application cinstructor, and the application is set to auto launch and has alt entry points.

 

I do not have a lock on the Event thread that I would normally have done, to do UI related tasks.

Should I be launching this code snippit from within an Application.invokeLater() ??????

 

Starnge thing is that it works great if the device is not "keyboard locked".

 

 

 

 

 

 

        if (!theApp.isForeground() && theApp.getPopUpNotification()) {

 

                UiEngine ui = Ui.getUiEngine();
                NotificationsManager.triggerImmediateEvent(UiApp.UM_NOTIFICATION, 0, this, null);
                   
                if (globalScreen != null) {
                    ui.dismissStatus(globalScreen);
                }
                   
                globalScreen = new NotificationPopup("Some Message", theApp); // My subclass of Dialog
                ui.queueStatus(globalScreen, 1, true);
        }

 

 

 

Thanks

Please use plain text.
Administrator
MSohm
Posts: 14,073
Registered: ‎07-09-2008
My Carrier: Bell

Re: UiEngine.queueStatus problem when device is locked

The code you have below appears fine, but it does sound like there is some kind of deadlock situation occuring.  Are you able to post the code for your custom dialog (NotificationPopup)?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
newbie100
Posts: 105
Registered: ‎05-22-2008

Re: UiEngine.queueStatus problem when device is locked

Yes, the code is very simple (posted below)

 

 

All it does is display a dialog with 2 buttons and a checkbox, and if the user selects "View" , I bring my application to the foreground.

 

(The checkbox is only there to signal the application never to pop up this box again)

 

Thanks

 

 

 

 

 

 

final class NotificationPopup extends Dialog implements FieldChangeListener, MessagesResource
{
   
    private boolean hasFields = false;
    private ButtonField btnView = null;
    private ButtonField btnClose = null;
    private CheckboxField dontDisplay = null;
    private UiApp theApp = null;
   
    public NotificationPopup(String s, UiApp theApp)
    {
        super(s, null, null, 0, Bitmap.getPredefinedBitmap(Bitmap.INFORMATION));
        this.theApp = theApp;
        btnView = new ButtonField(UiApp._resources.getString(NotificationPopup_View), Field.FIELD_VCENTER | Field.FIELD_HCENTER);
        btnClose = new ButtonField(UiApp._resources.getString(NotificationPopup_Close), Field.FIELD_VCENTER | Field.FIELD_HCENTER);
        dontDisplay = new CheckboxField(UiApp._resources.getString(NotificationPopup_DONT_DISPLAY_POPUP),false);
        btnView.setChangeListener(this);
        btnClose.setChangeListener(this);
        setEscapeEnabled(false);
        this.add(btnView);
        this.add(btnClose);
        this.add(dontDisplay);
        btnView.setFocus();
    }
   
   
    public void fieldChanged(Field f, int c)
    {
       
        if (f == btnView) {


            try {
                theApp.setInBoxEntry(false);
                theApp.requestForeground();
            } catch(Exception e) {
            }
           
        }
       
        if (dontDisplay.getChecked()) {
            theApp.setPopUpNotification(false);
        }
       
        close();
       
    }
   
    public void close()
    {
        super.close();
    }
}

 

 

 

 

Please use plain text.
Administrator
MSohm
Posts: 14,073
Registered: ‎07-09-2008
My Carrier: Bell

Re: UiEngine.queueStatus problem when device is locked

I created a MenuItem that sends an application to the background and then calls you code from your post on the 31st to display your custom dialog.  I tried this on a BlackBerry 8100 running 4.2.1.107 and was not able to reproduce the lock up.  What is the full, 4 digit handheld software version you are testing with?  Can you post a complete sample that reproduces this?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
newbie100
Posts: 105
Registered: ‎05-22-2008

Re: UiEngine.queueStatus problem when device is locked

Hi Mark,

 

I am testing on 4.2.1.103.

 

Also, in your test, you seem to process the event in the "UI Event Thread"

 

In my case, there is a background thread that pushes the Dialog.

This thread is NOT running in the context of the UI Event thread.

Perhaps that could be the reason why you cannot reproduce my problem ?

 

I will try to post a complete sample shortly. 

 

Thanks.

 

 

Please use plain text.
Developer
newbie100
Posts: 105
Registered: ‎05-22-2008

COMPLETE SAMPLE : Re: UiEngine.queueStatus problem when device is locked

Below is a small program that illustrates this behaviour.

 

Have tested on an 8800 4.2.1.101.

 

 

The application is set to AutoStart and is a System Module 

 

 

Brief explanation :-

 

Application starts up automatically, and launches a thread that periodically (every 10 sec) pushes a screen to the UiQueue.

 

If you lock your keyboard, the app continues to push the screen.

 

When you unlock your keyboard, you will see that the "pushed" screen does not render, unless you move the

trackball.

 

This gives the user that the device is "frozen"

 

 

Thanks

 

 

 

 

 

 

 


//package ;

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.system.Application;
import net.rim.device.api.ui.Screen;

import net.rim.device.api.system.Bitmap;


import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;

import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.CheckboxField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.Ui;
import net.rim.device.api.ui.UiEngine;


/**
 *
 */
class MainScreen extends UiApplication
{
    MainScreen()
    {   
        pushScreen(new DummyScreen());
   
    }
   
   
    public static void main(String[] argv)
    {
       
        MainScreen theApp = new MainScreen();
        theApp.enterEventDispatcher();
       
    }
}


class DummyScreen extends net.rim.device.api.ui.container.MainScreen
{

    private Screen globalScreen = null;
   
    public DummyScreen()
    {
       
       
        setTitle("Dummy Application");
       
        Thread t = new Thread(new Runnable()
        {
            public void run()
            {
               
                UiApplication theApp = (UiApplication) Application.getApplication();
                int i=0;
                while (theApp.isAlive()) {
                    i++;
                    try {
                        Thread.sleep(10000);
                    } catch(Exception e) {
                    }
               
               
               

                    try {

                        UiEngine ui = Ui.getUiEngine();
                   
                   
                        if (globalScreen != null) {
                            ui.dismissStatus(globalScreen);
                        }
                   
                        globalScreen = new NotificationPopup("In Loop =  " + i, theApp);
                        ui.queueStatus(globalScreen, 1, true);
                   
                    } catch(Exception e) {
                    }
               
               
                }
               
               
            }
        });
        t.start();
    }
   
}

 


final class NotificationPopup extends Dialog implements FieldChangeListener
{
   
   
    private ButtonField btnView = null;
    private ButtonField btnClose = null;
   
    private UiApplication theApp = null;
   
    public NotificationPopup(String s, UiApplication theApp)
    {
        super(s, null, null, 0, Bitmap.getPredefinedBitmap(Bitmap.INFORMATION));
        this.theApp = theApp;
        btnView = new ButtonField("Ok", Field.FIELD_VCENTER | Field.FIELD_HCENTER);
        btnClose = new ButtonField("Close", Field.FIELD_VCENTER | Field.FIELD_HCENTER);
       
        btnView.setChangeListener(this);
        btnClose.setChangeListener(this);
        setEscapeEnabled(false);
        this.add(btnView);
        this.add(btnClose);
       
        btnView.setFocus();
    }
   
   
    public void fieldChanged(Field f, int c)
    {
       
        if (f == btnView) {

            try {
                theApp.requestForeground();
            } catch(Exception e) {
            }
           
        }
       
       
        close();
       
    }
   
    public void close()
    {
        super.close();
    }
}
 

 

Please use plain text.