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. The difference between "Runtime.getRuntime().freeMemory();" and "ActivityManager.MemoryInf.availMem"

In Android System,
Is anyone know the difference between both above.


2. File permission about MediaPlayer

Code first:
                InputStream is = ;//some mixed audio
                byte buf[] = new byte[1024];

                File temp = File.createTempFile("aaa", ".mp3", 

                FileOutputStream out = new FileOutputStream(temp);
                do {
                        int numread =;
                        if (numread <= 0)
                        out.write(buf, 0, numread);
                } while (true);

                MediaPlayer mp = new MediaPlayer();

    I want to make some audio fragments to one audio file, and
MediaPlayer could not play with byte or stream, so I have to use
    upper code would: 11-05 05:47:37.512: WARN/System.err(3934): Prepare failed.: status=0xFFFFFFFC.
    But, if I copy the temp file aaa.mp3 out by File Explore, and copy
it into cache directory, the aaa.mp3 could be played.
    The temp file created by app in linux is : -rw------- app_18
app_18  2868352 2008-11-05 03:54 aaa13710.mp3
    The file copyed into cache is : -rw-rw-rw- root     root
2868352 2008-11-05 04:20 aaa13710.mp3
    The fiile copyed into sdcard is:----rw-rw- system   system
2868352 2008-11-05 05:12 aaa13710.mp3

   so, I guess MediaPlayer play audio files with root account.
Although creating temp file into sdcard is one solution, but i don't
think it is a good method for slow efficiency. MediaPlay should be
able to play with stream or byte, and it is a strange thing that I
could create an audio file but play it.
    I saw other developers post this error, google wishes developer
create temp files into sdcard, in fact, creating temp file into sdcard
cann't solve anything.


3. How to know when the map is really done zooming

4. MediaRecorder on G1

5. Change layout for different orientation

6. weird button behavior in emulator

7. How to trust an Intent sender?