how to transfer an action(ex:key press) from an Activity to other Activities

by Dianne Hackborn » Fri, 13 Mar 2009 03:02:29 GMT

Sponsored Links
 No you can't send events to other applications, sorry.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.


Other Threads

1. Salam Kenal + Numpang Nanya

Salam kenal temans

Saya Yudho...baru aja make andropnone-nya...masih belajar tepatnya
mau sekalian tanya...saya pake X10 plus unlimited XL tapi kok kurang
bertenaga ya? Alias sering putus tus nih
kebetulan saya tinggal di daerah kedoya..tapi kok saya bawa kemana2 masih
tetep sering putusnyambung ya

Mohon petunjukknya

ps: sekalian nyoba pmessenger kayaknya manteb numpang add ya teman2
PMID 218B0486

Terima kasih

"Indonesian Android Community [id-android]" 

2. android spinning image


i am trying to create two spinning wheels, as in pulleys, so everytime
the attached rope moves, the two pulleys will rotate.  i have tried
two approaches:

1) use Matrix.postRotate within the onDraw() method of the View class,
which calls the following:

        private void drawSpinningWheel(Canvas canvas)

                Bitmap bitmapOrg = null;

                int iDrawable = R.drawable.spinning_button;

                bitmapOrg = BitmapFactory.decodeResource(getResources(),

            if(bitmapOrg != null)
                    int width = bitmapOrg.getWidth();
                    int height = bitmapOrg.getHeight();
                    int newWidth = 24;
                    int newHeight = 24;

                    // calculate the scale - in this case = 0.4f
                    float scaleWidth = ((float) newWidth) / width;
                    float scaleHeight = ((float) newHeight) / height;

                    // createa matrix for the manipulation
                    Matrix matrix = new Matrix();
                    // resize the bit map
                    matrix.postScale(scaleWidth, scaleHeight);
                    matrix.postRotate((float) mDegrees++);

                        Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 
0, 0,
                            width, height, matrix, true);

                        canvas.drawBitmap(resizedBitmap, matrix, null);


                catch(Exception e)
                        Log.e(TAG + "drawSpinningWheel", e.getMessage());


but it seems like the image not only spins but rotates around another

2) use SurfaceView and a separate thread, in the run() call this:

        private void doDraw(Canvas canvas) {
            // Draw the background image. Operations on the Canvas
            // so this is like clearing the screen.
            canvas.drawBitmap(mBackgroundImage, 0, 0, null);

            int yTop = mCanvasHeight - ((int) mY +
mSpinningWheelImageHeight / 2);
            int xLeft = (int) mX - mSpinningWheelImageWidth / 2;


            // Draw the ship with its current rotation
            canvas.rotate((float) mHeading++, (float) mX,
                    - (float) mY);

                mSpinningWheelImage.setBounds(xLeft, yTop, xLeft +
mSpinningWheelImageWidth, yTop
                        + mSpinningWheelImageHeight);


i get the spinning to work but i can't add another spinning wheel.  i
even tried to create another thread for the second spinning wheel,
only one shows up.  can someone point me in the right direction?


3. Oot: Kenapa hrs pake email addrs

4. Animation and ListView

5. Is there a way to force deletion of User Data on Application upgrade?

6. Is there a way to force deletion of User Data on Application upgrade?

7. Progress Bar in every row of ListView