Retrieve position in an AnimationSet

by arnouf » Mon, 03 Nov 2008 02:11:24 GMT


Sponsored Links
 Hello,

I'm writting a small game but I've a BIG problem.
I've a picture where I set animation. The pic goes down and up on
screen. When I click on this pic I would like retrieve his position
but.

When I create the object, it's placed at 0,0...
When it goes down, if I click on it nothing happens. If I click on the
original position, I retrieve my position but it's still 0,0, even if
my pic is on the bottom of the screen!

Find below a part of my code
Animation rootSet = new AnimationSet(true);
                rootSet.setInterpolator(new AccelerateInterpolator());
                rootSet.setRepeatCount(Animation.INFINITE);
                rootSet.setRepeatMode(Animation.INFINITE);
                float positionYStart = 0;
                int timing = 0;

                while (positionYStart<maxHeight) {
                        // Create and add first child, a motion animation.
                                TranslateAnimation transRight = new 
TranslateAnimation(0,15, 0,
15);
                                transRight.setStartOffset(timing);
                                transRight.setFillAfter(true);
                                transRight.setDuration(speedUp);
                                rootSet.addAnimation(transRight);

                                TranslateAnimation transLeft = new 
TranslateAnimation(0,-15, 0,
15);
                                transLeft.setStartOffset(timing+speedUp);
                                transLeft.setDuration(speedUp);
                                transRight.setFillAfter(true);
                                rootSet.addAnimation(transLeft);

                                timing = timing+speedUp*2;
                                positionYStart = positionYStart+30;
                        }
                this.setAnimation(rootSet);
                this.startAnimation(rootSet);

This a class extended ImageView

public MyClass(Drawable d, Context c, int screenWidth){
                super(c);

                setImageDrawable(d);
                setBackgroundColor(Color.GRAY);
                super.setFrame(new Random().nextInt(screenWidth), 0, 30,30);
                setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
        }

Thanks for your help
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Droid/Milestone: GL_OES_framebuffer_object reported but not working

Hi,

I'm trying to use the framebuffer object extension on Milestone with
2.0 firmware. The extension is reported by OpenGL but when you try to
use it then my app aborts. No message, no stacktrace, nothing.

Here is a simple code snippet for creating a framebuffer object:

int createFBO(GL11 gl) {
  boolean hasFBO = isGLExtensionAvailable
("GL_OES_framebuffer_object"); // internal function for GL_EXTENSIONS
lookup
  if (! hasFBO)
    return 0;

  if (! (gl instanceof GL11ExtensionPack))
    return 0;
  GL11ExtensionPack glext = (GL11ExtensionPack)gl;

  int[] handles = new int[1];
  glext.glGenFramebuffersOES(1, handles, 0); // aborts on Milestone
  return handles[0];
}

Has anyone had any luck using FBO?

-- 

2. AES decryption is slow....

hi,

I am trying to do AES decryption like this --

Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, aesKey);
cipher.update(encryBytes, 0, encrByteCount);

And it is taking me about 2.5+ seconds to run just the cipher.update
(i.e. I excluded the init and getInstance() calls) for 65KB of data --
which seems way too long.

What this translates to (roughly) 60 seconds for a 1.5MB file.  Which
is uber slow.

I *am* actually seeing 60 or so seconds when I try to decrypt that big
of a file (looping through and feeding buffers).

Does anybody know why AES decryption is so slow on Android?  A co-
worker is seeing times around 10 seconds for the same file on a RIM
device.

tia.

-- 

3. Mohon gabung ..

4. twtpic4j is not throwing exception

5. Portrait vs landscape using sensor

6. AudioTrack stop/release

7. Viamici 鈥?the First Map Cali bration Solution for the Android Platform