BlackBerry app loses focus and causes app to freeze -
the project i'm working on, uses blackberry sdk 6, reported bug in when closing mainscreen causes app lose focus , stops being responsive, message reported on console output foreground app ******* lost focus has no screens
. let me clarify message shown though screen on app remains visible somehow app lost focus.
i haven't been able pinpoint conditions trigger bug, tried take case many mainscreens opened , closed them pressing button. i'll try update more clear output when trigger bug.
on every mainscreen onclose
method overriden call method inside our screenmanager class, class created handle opening , closing of our mainscreens, code looks this:
pubic void back() { if(pagestack.size() - 1 == 0) { // if 1 screen in our stack collection, show prompt asking if user wants close app int choose=dialog.ask(dialog.d_yes_no, ui.getrb().getstring(ui.exit_yes_no)); if(choose==dialog.yes) { system.exit(0); } } else { // in case our stack of screens has more 1 screen remaining pop our stack poppagestack(); } }
the code poppagestack this:
private void poppagestack() { pagestack.removeelementat(pagestack.size()-1); uiapplication.getuiapplication().popscreen(uiapplication.getuiapplication().getactivescreen()); }
is possible during popscreen call cause this? i'm starting developing on blackberry don't know if situation popscreen call made , while screen before 1 poped being rendered can no screens on app case possible?
edit
i made test project menu item when clicked, removes screen being displayed, after behaviour described earlier happened. indeed, i'm running out of screens somehow , last 1 displayed remains "displayed" no interaction can made since it's been popped out already.
i'm checking original project don't understand how can trigger onclose call when i'm moving using button. anyway if reach last window, dialog should pop asking if app should close.
edit 2
i able reproduce bug 2 times, although after several tries. console output got this:
[0.0] jvm: bklt @12347710: settimer 30 [0.0] uie: focus - target lost, prev=null, input=null, app=com.yallaya.rbt.main@9b0462e2 [0.0] uie: foreground app com.yallaya.rbt.main@9b0462e2 lost focus because has no screens. [0.0] uie: focus - target lost, prev=null, input=null, app=com.yallaya.rbt.main@9b0462e2 [0.0] uie: foreground app com.yallaya.rbt.main@9b0462e2 lost focus because has no screens. [0.0] uie: foreground app com.yallaya.rbt.main@9b0462e2 has no screens. should corrected. [0.0] uie: foreground app com.yallaya.rbt.main@9b0462e2 ignoring touchscreen touch/click because has no[0.0] target screen. [0.0] jvm: bklt @12377703: timer [0.0] jvm: bklt[1] @12377703: usridle 27, usrtime 30, usract 1 [0.0] jvm: bklt[1] @12377703: chkidle 29, currtime 30 [0.0] jvm: bklt @12377703: settimer 3 [0.0] jvm: bklt @12380734: timer [0.0] jvm: bklt[1] @12380734: usridle 30, usrtime 30, usract 1 [0.0] jvm: bklt[1] @12380734: chkidle 33, currtime 30 [0.0] jvm: bklt[1] @12380734: enablebacklight 0 [0.0] jvm: bklt[1]: settimeout 30 [0.0] jvm: bklt[1] @12386796: jbsc on=0 [0.0] jvm: bklt[1] @12386796: sc 0 [0.0] jvm: bklt[1]: settimeout 30 [0.0] jvm: bklt[1] @12388023: jbsc on=1 [0.0] jvm: bklt[1] @12388023: sc 1 [0.0] jvm: bklt @12388023: settimer 30
every time tried interact screen (either touch or hardware input), [0.0] uie: foreground app com.yallaya.rbt.main@9b0462e2 has no screens. should corrected.
line show.
does give hint on problem?
@uriel arvizu
since have have @ least 1 screen present on display stack call parent screen convention (not concept) if poping screen display stack , trying run after show device hang or screen lag...
so when implementing popscreen method, suggest implement on screen class( extending mainscreen ) , provide "this" current instance of screen.. , can call method pop screen on button click :
buttonfield buttonback = new buttonfield(new stringprovider("back")); buttonback.setchangelistener(new fieldchangelistener() { public void fieldchanged(field field, int context) { closethisscreen(); } });
method close screen in same class
void closethisscreen() { uiapplication.getuiapplication().popscreen(this); }
when displaying home screen , user press button display message , close application implement on home screen
public boolean onclose() { int response = dialog.ask(dialog.d_yes_no,"are sure want exit?"); if (response == -1) { return false; } else { system.exit(0); return true; } }
Comments
Post a Comment