View Single Post
Old 11-24-2008, 10:06 AM   #9 (permalink)
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've modified the code:

Code:
public class PretiumMain extends UiApplication{
	

	
	public static void main(String[] args) {
		PretiumMain theApp = new PretiumMain();			
		theApp.enterEventDispatcher();	
		
	}

	public PretiumMain() {

			PretiumController controller = new PretiumController();
			
			InicioScreen inicio = new InicioScreen(controller);

			UiApplication.getUiApplication().pushScreen(inicio);

	
	}

}

public class InicioThread extends Thread{
	
	PretiumController controller;
	InicioScreen pantalla;
	
	public InicioThread(PretiumController controller, InicioScreen pantalla){
		this.controller = controller;
		this.pantalla = pantalla;
		this.setPriority(1);
	}
	
	public void run() {
		try {
			sleep(2000);			
			controller.inicializarApp();
			pantalla.inicializarAplicación();
		} catch (Exception e) {
			pantalla.informarExcepción(e.getMessage());
		}
		
	}
	
}

public class InicioScreen extends MainScreen {
			
	PretiumController  controller;
	
	
	public InicioScreen(PretiumController controller){
		this.controller = controller;
		
		InicioLabelField inicio = new InicioLabelField(controller, "Iniciando aplicación...");
		
		add(inicio);	
		
		InicioThread t = new InicioThread(controller, this);
		
		t.start();
		
		
		

	}
	
	
	
	public  void inicializarAplicación(){
		
			try{			
				UiApplication.getUiApplication().pushScreen(new SeleccionClienteScreen(controller));
				
			}catch(Exception e){
				Dialog.inform(e.getMessage());
			}
			
		
	}
	

	
	public void informarExcepción(String mensaje){
		Dialog.inform(mensaje);
	}
	
	

}
This doesnt work too. What I want is the InicioScreen be painted at the begining, while the InicioThread calls the webservice, so the user can see "Application loading...".

Thanks.
Offline   Reply With Quote