我有一個黑莓應用程序,當在一些仿真器與觸摸的支持(例如:9500,9520,9530,9550)上運行,終止與:BlackBerry:由於UiApplication.getUiApplication(),「應用程序沒有響應;進程終止」popScreen()?
「應用程序沒有響應;處理XPTO終止」
使用日誌,我發現它似乎像應用程序停止在一個類中,我通過異步HTTP請求:是這樣的:
public class LoadingFullScreen extends FullScreen implements Runnable {
private Thread actionThread = null;
protected void onDisplay() {
actionThread = new Thread(this);
actionThread.start();
}
protected void onUndisplay() {
if(actionThread != null && actionThread.isAlive()) {
actionThread.interrupt();
}
}
public void run() {
//make http requests - this is done successfully
synchronized(Application.getEventLock()) {
Screen active = UiApplication.getUiApplication().getActiveScreen();
if (active instanceof LoadingFullScreen) {
Logger.debug("LoadingFullScreen popping screen"); //this appears in logs
UiApplication.getUiApplication().popScreen(active);
Logger.debug("LoadingFullScreen screen popped"); //this never appears in logs
}
}
}
}
我推出這個屏幕UiApplication.getUiApplication().pushModalScreen(new LoadingFullScreen())
在日誌中我可以看到:
[0.0] Wed Jul 27 17:53:06 GMT 2011 - DEBUG: LoadingFullScreen popping screen
[0.0] JVM: bklt[1] @163148: JBSC on=0
[0.0] JVM: bklt[1] @163148: SC 0
[0.0] JVM: bklt[1]: setTimeout 30
[0.0] Application XPTO(212) is not responding; process terminated
好像UiApplication.getUiApplication().popScreen()
阻止應用程序,所以OS殺死的應用,但是爲什麼呢?
編輯:
我一直在使用
UiApplication.getUiApplication().invokeLater(new Runnable() {...} };
代替synchronized(Application.getEventLock()) {...}
也試過,但我有相同的結果
編輯2:
我也嘗試過,而不是active.close()
UiApplication.getUiApplication().popScreen(active);
但我有完全相同的結果
編輯3: 使用javaloader
我得到了這樣的堆棧跟蹤從仿真器:
guid:0x9C3CD62E3320B498 time: Thu Jul 28 15:02:50 2011 severity:0 type:3 app:Java Exception data:
ForcedStackTraceException
net_rim_services_impl(4) 27 2 0x1030B000
net_rim_os-3(4BEF0320)
HttpConnectionManager$CleanupThread
run
0x3B09
guid:0x9C3CD62E3320B498 time: Thu Jul 28 15:02:50 2011 severity:0 type:3 app:Java Exception data:
ForcedStackTraceException
XPTO(247) 60 4 0x124A0400
net_rim_cldc-16(4BEEF8A5)
TextField
getFocusRect
0x2A61
net_rim_cldc-12(4BEEF8A5)
Manager
getFocusRect
0x717
net_rim_cldc-12(4BEEF8A5)
Manager
getFocusRect
0x717
net_rim_cldc-12(4BEEF8A5)
Screen
getFocusRect
0x9AF2
net_rim_cldc-12(4BEEF8A5)
Screen
callOnExposed
0x9D16
net_rim_cldc-13(4BEEF8A5)
UiEngineImpl
<private>
0x9007
net_rim_cldc-13(4BEEF8A5)
UiEngineImpl
removeScreen
0x7D08
net_rim_cldc-12(4BEEF8A5)
Screen
close
0x6B66
XPTO-8(4E316B06)
LoadingFullScreen$1
run
0x34D5
net_rim_cldc-8(4BEEF8A5)
Application
dispatchInvokeLater
0x1A87
net_rim_cldc-8(4BEEF8A5)
Application
<private>
0x2809
net_rim_cldc-8(4BEEF8A5)
Application
processNextMessage
0x1AEF
net_rim_cldc-9(4BEEF8A5)
ModalEventThread
run
0xBE4F
guid:0x9C3CD62E3320B498 time: Thu Jul 28 15:02:50 2011 severity:0 type:3 app:Java Exception data:
ForcedStackTraceException
XPTO(247) 30 2 0x139DA800
net_rim_cldc(4BEEF8A5)
Object
wait
0x9922
net_rim_cldc-8(4BEEF8A5)
Application
startModalEventThread
0x1EB8
net_rim_cldc-13(4BEEF8A5)
UiEngineImpl
addScreenModal
0x83F4
net_rim_cldc-13(4BEEF8A5)
UiEngineImpl
pushModalScreen
0x674E
net_rim_cldc-13(4BEEF8A5)
UiApplication
pushModalScreen
0x62B0
XPTO-8(4E316B06)
MyBaseScreen
<private>
0x3AA6
XPTO-8(4E316B06)
MyBaseScreen
openTheModalScreenFunction
0x382C
XPTO-8(4E316B06)
MyBaseScreen$4
fieldChanged
0x4271
net_rim_cldc-11(4BEEF8A5)
Field
fieldChangeNotify
0x160B
net_rim_cldc-16(4BEEF8A5)
TextField
replace
0x7A5
net_rim_cldc-16(4BEEF8A5)
TextField
inputMethodTextChanged
0x24E1
net_rim_cldc-15(4BEEF8A5)
PasswordEditField
inputMethodTextChanged
0x4F26
net_rim_cldc-27(4BEEF8A5)
IMContext
dispatchInputMethodEvent
0x1E00
net_rim_tid-4(4BEEF8E1)
SLInputMethod
sendComposedText
0x5CA1
net_rim_tid-4(4BEEF8E1)
SLInputMethod
sendComposedText
0x5BD1
net_rim_tid_fastEuropean(4BEF034C)
FastEuropeanInputMethod
sendComposedText
0x48E1
net_rim_tid_fastEuropean(4BEF034C)
FastEuropeanInputMethod
dispatchConversionEvent
0x43E3
net_rim_tid-4(4BEEF8E1)
SLInputMethod
dispatchKeyEvent
0x5309
net_rim_tid-4(4BEEF8E1)
SLInputMethod
dispatchEvent
0x63CA
net_rim_tid_fastEuropean(4BEF034C)
FastEuropeanInputMethod
dispatchEvent
0x426E
net_rim_cldc-27(4BEEF8A5)
InputContext
dispatchEvent
0x3E15
net_rim_cldc-27(4BEEF8A5)
IMContext
dispatchEvent
0x21DE
net_rim_cldc-11(4BEEF8A5)
Field
dispatchEvent
0x3739
net_rim_cldc-16(4BEEF8A5)
TextField
dispatchEvent
0x30F6
net_rim_cldc-27(4BEEF8A5)
EventHandler
<private>
0x1460
net_rim_cldc-27(4BEEF8A5)
EventHandler
processKeyEvent
0x1A79
net_rim_cldc-16(4BEEF8A5)
TextField
processKeyEvent
0x37F6
net_r
編輯4: 我試圖在LoadingFullScreen
移動run()
方法到一個新的Runnable
類,有人告訴我,當該課程顯示爲模態屏幕時,LoadingFullScreen implement Runnable
可能會導致問題。
但是,我沒有運氣,我仍然有同樣的問題。
任何想法?
您是否使用任何覆蓋「活動」,例如的OnClose()? –
嗨雷。我重寫了顯示和onUndisplay。我正在編輯帖子,添加這些方法 – pandre
我使用UiApplication.getUiApplication()。pushModalScreen(new LoadingFullScreen())啓動此屏幕,是否有任何影響? – pandre