Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 1.39 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Network Thread blocking UI
  2. mainButton=new BitmapButton(Bitmap.getBitmapResource("elcomercio.​gif"), Bitmap.getBitmapResource("elcomercio.gif"), Field.FOCUSABLE){
  3.         protected boolean navigationClick(int status,int time) {
  4.             //It automatically add itself to the screen stack
  5.             waitScreen=new WaitScreen();
  6.             TimeOutThread timeOut=new TimeOutThread(HomeScreen.this, 10000);
  7.             HttpHelper helper=new HttpHelper("http://www.elcomercio.com/rss/latest", null, HomeScreen.this, HttpHelper.GET);
  8.             UiApplication.getUiApplication().invokeLater(timeO​ut);
  9.             UiApplication.getUiApplication().invokeLater(helpe​r);
  10.             return true;
  11.         }
  12.     };
  13.        
  14. public void onTimeout() {
  15.     if(!didTimeout.booleanValue()){
  16.         UiApplication.getUiApplication().popScreen(waitScr​een);
  17.         didTimeout=Boolean.TRUE;
  18.     }
  19. }
  20.        
  21. mainButton = new BitmapButton(Bitmap.getBitmapResource("elcomercio.​gif"), Bitmap.getBitmapResource("elcomercio.gif"), Field.FOCUSABLE)
  22. {
  23.     protected boolean navigationClick(int status,int time)
  24.     {
  25.         waitScreen = new WaitScreen();
  26.         TimeOutThread timeOut=new TimeOutThread(HomeScreen.this, 10000);
  27.         HttpHelper helper = new HttpHelper("http://www.elcomercio.com/rss/latest", null, HomeScreen.this, HttpHelper.GET);
  28.         timeO​ut.start();
  29.         helpe​r.start();
  30.         return true;
  31.     }
  32. };