Search code examples
blackberryscreenfieldmanagermainscreen

how to show Screen within MainScreen in application


My application have one screen below the detail of that. Screen name EventList . This screen have designed full. There are two ButtonField Next and Previous . At the bottom of these two Button ListField is placed in this screen.

When i click on Next or Previous my ListField will update . It is updated successfully using updateListField() method which is created in this screen. All is working fine up to this. But my concern is that when i click on these Button ListField will take time (around 3 or 4 second)to update new data. During my data updating in background i want to show Massage like Please wait.../Loading.... How can i show this without using PopupScreen.

i had tried the below code but not working properly.

VerticalFieldManager manager = new VerticalFieldManager();

manager.add(new LabelField("Please Wait..."));
Screen popup = new PopupScreen(manager);

If i will done this using PopupScreen my full logic will be change for that screen and it will time consuming task.

Please suggest me how can we add FieldManager on existing MainScreen.

Thanks in Advance !!!


Solution

  • Application.getApplication().invokeLater( 
    new Runnable() { 
    public void run() { 
    
    GIFEncodedImage image; 
    EncodedImage encodedImage = EncodedImage 
    .getEncodedImageResource("spiral.gif"); 
    byte data[] = new byte[3000]; 
    data = encodedImage.getData(); 
    image = (GIFEncodedImage) EncodedImage 
    .createEncodedImage( 
    data, 0, 
    data.length); 
    AnimatedGIFField animatedGIF = new AnimatedGIFField( 
    image); 
    
    PopupScreen popup = new PopupScreen( 
    new VerticalFieldManager()); 
    popup.add(animatedGIF); 
    Border border = BorderFactory 
    .createSimpleBorder( 
    new XYEdges(), 
    Border.STYLE_SOLID); 
    popup.setBorder(border); 
    UiApplication 
    .getUiApplication() 
    .pushScreen(popup); 
    
    Timer timer = new Timer(); 
    timer.schedule(new CountDown(), 
    3000); 
    
    } 
    });