views:

150

answers:

1

Hi,

I've just started with Android, I'm making a simple Live wallpaper. I'm testing it on a 2.1 emulator. The trouble is while it works in the preview screen before you choose "Set Wallpaper" the touch events don't appear to register on the screen once you've selected it as a wallpaper. Do I need to state anything in the manifest about touch events or so to get it to work? Little bit confused why it would work in one and not the other.

public void handleTouchEvent(MotionEvent event) {

    if(event.getAction() == MotionEvent.ACTION_UP) {
        //add new BulletHole
        int x = (int)event.getX();
        int y = (int)event.getY();
        synchronized(holes) {
            holes.add(new BulletHole(x,y));
        }
    }

    this.pause = false;     
    synchronized(this) {
        notify();
    }
}
A: 
    @Override
    public void onCreate(SurfaceHolder surfaceHolder) {
        super.onCreate(surfaceHolder);

        // By default we don't get touch events, so enable them.
        setTouchEventsEnabled(true);
    }

??? Does this seam to help?

Seraph
Thanks very much, but that isn't the case. I've since realised that the onCreate function is not being called when the wallpaper is set. Restarting the phone however, will call it !
Garcon