04-16-2012 05:51 AM
Hi all,
My phone is BOLD 9700, OS 6.0.0.668
I create a popupScreen use the ActivityIndicatorView and use it.
It doesn't appear when the mainScreen constructor launch, however it appear called by button click event.
ActivityIndicatorView Code:
public class PopupLoadingScreen extends PopupScreen{
public PopupLoadingScreen(String text){
super(new HorizontalFieldManager(),DEFAULT_CLOSE);
System.out.println("-------------Enter PopupLoadingScreen--------------");
ActivityIndicatorView view = new ActivityIndicatorView(Field.FIELD_VCENTER);
ActivityIndicatorModel model = new ActivityIndicatorModel();
ActivityIndicatorController controller = new ActivityIndicatorController();
view.setController(controller);
view.setModel(model);
controller.setModel(model);
controller.setView(view);
model.setController(controller);
Bitmap bitmap = Bitmap.getBitmapResource("loading_full.png");
view.createActivityImageField(bitmap, 10, Field.FIELD_HCENTER);
this.add(view);
System.out.println("---------------------Add loading view success------------------");
LabelField label = new LabelField(text,Field.FIELD_VCENTER);
this.add(label);
}
public void close() {
System.out.println("---------------Close loading-------------");
UiApplication.getUiApplication().popScreen(this);
}
}MainScreen constructor:
public PlayScreen(final String serverAddr, final String userName, final String passwd, int channelNum){
super(NO_VERTICAL_SCROLL|NO_VERTICAL_SCROLLBAR);
System.out.println("--------------Enter playScreen-------------");
//Light the backlight
BackLightController blc = new BackLightController();
blc.run();
Timer timer = new Timer();
timer.schedule(blc, 255000, 255000);
CheckNetworkStatus checkConn = new CheckNetworkStatus();
_connStr = checkConn.getInternetConnectionString();
//Add the default playField
Bitmap defaultImg = Bitmap.getBitmapResource("blackScreen.png");
playField = new BitmapField(defaultImg);
add(playField);
System.out.println("11111111111111111");
synchronized (UiApplication.getEventLock()) {
loadingImg = new PopupLoadingScreen("Loading...");
UiApplication.getUiApplication().pushScreen(loadin gImg);
}
System.out.println("22222222222222222");
channelFm = new HorizontalFieldManager();
final ButtonField [] btnArr = new ButtonField[channelNum];
try{
for(int i = 0; i <channelNum; i++){
final int channel = i + 1;
btnArr[i] = new ButtonField(""+(i+1));
btnArr[i].setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
channelSelect = channel;
disableBtn(btnArr);
launchRTSPThread(serverAddr, userName, passwd);
}
});
btnArr[0].setEnabled(false);
btnArr[0].setEditable(false);
channelFm.add(btnArr[i]);
}
add(channelFm);
}catch(Exception e){
System.out.println("---------------------Get btn image error: " + e + "----------------------");
}
launchRTSPThread(serverAddr, userName, passwd);
}Get Stream image called button click event:
public void launchRTSPThread(String serverAddr, String userName, String password){
synchronized (UiApplication.getEventLock()) {
if(loadingImg.isDisplayed()){
UiApplication.getUiApplication().popScreen(loading Img);
}
// loadingImg = new PopupLoadingScreen("Loading...");
UiApplication.getUiApplication().pushScreen(loadin gImg);
}
if(GetStreamImage != null){
GetStreamImage.stop();
}
_url = serverAddr + "/image.cgi?camera="+ channelSelect + _connStr;
GetStreamImage = new RTSPThread(playField, _url, userName, password, loadingImg);
GetStreamImage.processFetchImage();
}
Please tell me how to fix it, thanks.