我想從J2ME midlet中調用一個Servlet,所以我編寫了Servlet URL的HTTPConnection代碼來調用GET方法。爲什麼J2ME Midlet Suite和HTTPConnection需要使用不同的線程
當MIDlet套件試圖連接到服務器URL,我已經得到了在模擬器中下面的消息,
{#MyMidlet} Midlet Suite wants to connect to {#Servlet URL} using air time,
this may result in charges, Is it ok to use airtime ?
如果我點擊有或無,什麼都沒有發生,它剛剛絞死,我使用EclipseME和SUN WTK 2.5.2。並在控制檯中出現警告,
Warning: To avoid potential deadlock, operations that may block, such as
networking, should be performed in a different thread than the
commandAction() handler.
這意味着,如果我做一個單獨的線程中爲HttpConnection,將問題解決呢?
試試看! – funkybro 2012-07-26 07:27:49
它的工作,當我改變HttpConnection在不同的線程。謝謝 !! – Murugesh 2012-07-26 13:47:40
沒問題!雖然下次我只是自己嘗試一下,而不必在這裏發佈問題......節省了很多時間! – funkybro 2012-07-26 14:10:55