Note that there are some explanatory texts on larger screens.

plurals
  1. POBlackberry Animation Issue on App's Home Screen
    primarykey
    data
    text
    <p>I am trying to create an Application which has a Home Screen (<code>MyScreen</code> below) animation in Blackberry which makes an image float from the bottom to middle of the screen. Then after that, i want to push another Screen which brings a Login Screen or something (<code>NewScreen</code> below).</p> <p>I am getting a blank Screen after the animation. On pressing <strong>back</strong> once, i am getting the Screen i pushed from the Animation Screen. Please guide me: where should i push to get the perfect result?</p> <pre class="lang-java prettyprint-override"><code>import net.rim.device.api.animation.AnimatedScalar; import net.rim.device.api.animation.Animation; import net.rim.device.api.animation.Animator; import net.rim.device.api.animation.AnimatorListener; import net.rim.device.api.system.Bitmap; import net.rim.device.api.system.Display; import net.rim.device.api.system.EncodedImage; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.Screen; import net.rim.device.api.ui.TransitionContext; import net.rim.device.api.ui.Ui; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.UiEngineInstance; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.container.PopupScreen; /** * A class extending the MainScreen class, which provides default standard * behavior for BlackBerry GUI applications. */ public final class MyScreen extends MainScreen implements AnimatorListener { private RectangleToMove _rect; private Animator _animator; private Animation _xanimation; private Animation _yanimation; private boolean _bAnimating; public static final int BALL_WIDTH = 50; public Bitmap splashimg; static TransitionContext transitionContextIn; static TransitionContext transitionContextOut; static UiEngineInstance engine = Ui.getUiEngineInstance(); /** * Creates a new MyScreen object */ public MyScreen() { EncodedImage img = EncodedImage.getEncodedImageResource("logo.png"); splashimg = img.getBitmap(); _bAnimating = false; int midScreen = (Display.getWidth() / 2) - img.getWidth()/2; int endScreen = Display.getHeight(); _rect = new RectangleToMove(midScreen, BALL_WIDTH); _animator = new Animator(30); _animator.setAnimatorListener(this); _yanimation = _animator.addAnimationFromTo(_rect.getY(), AnimatedScalar.ANIMATION_PROPERTY_SCALAR, endScreen - BALL_WIDTH, Display.getHeight() / 2-30, Animation.EASINGCURVE_LINEAR, 3000L); _yanimation.setRepeatCount(1f); _yanimation.begin(0); UiApplication.getUiApplication().pushScreen(new NewScreen()); } protected void paint(Graphics g) { if (_bAnimating) { _rect.draw(g, splashimg); } } public void animatorUpdate() { invalidate(); doPaint(); } public void animatorProcessing(boolean processing) { _bAnimating = processing; } } class RectangleToMove { private int xPos; private AnimatedScalar yPos; public void draw(Graphics g, Bitmap splashimg) { g.setBackgroundColor(Color.BLACK); g.clear(); g.setColor(Color.SLATEGRAY); g.drawBitmap(xPos, yPos.getInt(), splashimg.getWidth(), splashimg.getHeight(), splashimg, 0, 0); /* * g.fillEllipse(xPos,yPos.getInt(), * xPos+MyScreen.BALL_WIDTH,yPos.getInt(),xPos, * yPos.getInt()+MyScreen.BALL_WIDTH,0,360); */ } public int getX() { return xPos; } public AnimatedScalar getY() { return yPos; } RectangleToMove(int x, int y) { xPos = x; yPos = new AnimatedScalar(y); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload