android - Getting a gestureoverlayview -
i have been using nice tutorials on drawing graphics on android. wanted add in 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 fine , dandy yet realize in demo i'm trying build using code "playing graphics in android". demos make sense, makes sense found out using:
setcontentview(new panel(this));
as required playing graphics tutorials, findviewbyid seems no longer valid , returns null. @ first post stupider question why happening, quick test of playing setcontentview made me realize cause of findviewbyid returning null, not know how remedy issue. whats key missing here? realize new panel doinking reference not sure how make connection here.
the: r.id.gestures defined right int main.xml as: (just tutorial)
<android.gesture.gestureoverlayview android:id="@+id/gestures" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1.0" />
so did confirm
setcontentview(new panel(this))
is causing issue. know issue have figure out how add android.gesture.gestureoverlayview panel class somehow, not sure how go this.
after fighting know need how it. think need either equivalent of creating panel in main.xml or figuring out how build whats in main.xml gestures in code. close because did this: gestureoverlayview gestures = new gestureoverlayview(this);
which gets me non null gestures now, unfortunately since not telling fill parent anywhere don't think showing up, trying hard figure out layout pa rams. on right track?
i've been working through of sample code myself, , have yet write meaningful, perhaps it's simple as, system can't find view because you've set different one?
most of samples have in setcontentview reference resource (e.g. setcontentview(r.id.gestures)
), don't they? therefore it's unsurprising that view can't later found. ...unless i'm totally newb failing on point...
Comments
Post a Comment