Getting a gestureoverlayview

Posted by Codejoy on Stack Overflow See other posts from Stack Overflow or by Codejoy
Published on 2010-04-27T20:48:17Z Indexed on 2010/04/27 21:33 UTC
Read the original article Hit count: 504

I have been using some nice tutorials on drawing graphics on my android. I wanted to also add in the cool gesture demo found here:

http://developer.android.com/resources/articles/gestures.html

That takes these lines of code:

GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this); 

This is fine and dandy yet I realize in my demo i'm trying to build using code from "Playing with Graphics in Android". The demos make sense, everything makes sense but I found out by using:

setContentView(new Panel(this));

as is required by the Playing With Graphics tutorials, then the findViewById seems to no longer be valid and returns null. At first I was about to post a stupider question as to why this is happening, a quick test of playing with the setContentView made me realize the cause of findViewById returning null, I just do not know how to remedy this issue. Whats the key I am missing here? I realize that the new Panel is doinking some reference up but I am not sure how to make the connection here.

THe: R.id.gestures is defined right int he main.xml as: (just like the tutorial)

Thanks, Shane

p.s. im new here be gentle.

© Stack Overflow or respective owner

Related posts about android

Related posts about gestures