UINavigationControl for BlackBerry

67 views Asked by At

I am developing an application for Blackberry OS 5.0 and later.

On the iPhone, UINavigationControl is a really cool UI component. How can I implement the same control for a BlackBerry application?

1

There are 1 answers

0
Himanshu Sharma On

You need to override the touchEvent of the field , below is the example,Here i m overriding the toucevent to make the map navigation on touchevent when a user moves his finger on touchscreen the map starts scrollin in that direction similarly you can do the same for any field :

map = new MapField(){

        public boolean touchEvent(TouchEvent message){
            int x=message.getX(1);
            int y=message.getY(1);
            if(message.getEvent()==TouchEvent.MOVE){


                XYPoint _xyIn = new XYPoint();
                XYPoint _xyOut = new XYPoint();

                _xyIn.x=x;
                _xyIn.y = y;
                convertFieldToWorld(_xyIn,_xyOut);

                map.moveTo(_xyOut.y,_xyOut.x);
                return true;
            }else if(message.getEvent()==TouchEvent.CLICK){
                //Do what you want when a user clicks on the screen
            }
            return false;

        }
    };