开发者

Loading Screen wheel with using Blackberry JAVA SDK 6.0 Activity Indicator UI element

In my project,I want to show a loading screen with a rolling wheel image(possibly with a .gif file) while my http connection occured.

My code is below. It extends a class which extends MainScreen. I show this screen when the user clicked login button.

public class MSWheelScreen extends MSScreen{



//Constructor
public MSWheelScreen(){
    super();

    add(new SeparatorField());
    add(new LabelField("Loading...", Field.FIELD_HCENTER));
    add(new SeparatorField());
    add(new LabelField());


    ActivityIndicatorView myview = new ActivityIndicatorView(Field.USE_ALL_WIDTH);
    ActivityIndicatorModel mymodel = new ActivityIndicatorModel();
    ActivityIndicatorController mycontroller = new ActivityIndicatorController();

    myview.setController(mycontroller);
    myview.setModel(mymodel);

    mycontroller.setModel(mymodel);
    mycontroller.setView(myview);

    mymodel.setController(mycontroller);




    Bitmap mybitmap = Bitmap.getBitmapResource("img/wheel.gif");

    myview.createActivityImageField(mybitmap, 5, Field.FIELD_HCENTER);
    add(myview);

}



}

Anyway; my problem is that, I cant show the wheel image as i wanted. I can only see the part of the wheel, i am not able to see the whole .gif file as i open it in a browser. So i want to adjust the .gif file that i have added on the lo开发者_Python百科ading screen. I want to know some built in methods that i can use with activity indicator UI elements to adjust my gif.

The link for my sample run screenshot:

http://imageshack.us/photo/my-images/191/9800j.jpg/

The link for original gif.

http://imageshack.us/photo/my-images/810/ajaxloaderw.gif/


It is difficult to implement loading screen with .gif bcz it required one more thread that handle .gif image So i always implement Loading screen in blackberry like this :

This is simple code for loading screen ....

                HorizontalFieldManager popHF = new HorizontalFieldManager();
                popHF.add(new CustomLabelField("Pls wait..."));
                final PopupScreen waitScreen = new PopupScreen(popHF);
                new Thread()
                {
                    public void run() 
                    {

                        synchronized (UiApplication.getEventLock()) 
                        {
                            UiApplication.getUiApplication().pushScreen(waitScreen);
                        }
                       //Here Some Network Call 

                       synchronized (UiApplication.getEventLock()) 
                        {
                            UiApplication.getUiApplication().popScreen(waitScreen);
                        }
                     }
                 }.start();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜