In the SurfaceView that gets created I override onTouchEvent. Setting my DrawShape variable for the SurfaceView that gets created will change the type of object being drawn on the canvas when the user touches the screen.
I could swear that I have already tried to set the view id and get a reference to it. However, I have tried many different approaches. If the is the correct approach, I will try it again immediately and post my results. Thanks! James On Jan 11, 7:46 pm, Kristopher Micinski <krismicin...@gmail.com> wrote: > On Wed, Jan 11, 2012 at 9:36 PM, JamesColeman > > <jamescole...@radicalphotography.com> wrote: > > I draw various objects on the SurfaceView canvas. I also have a > > dialog screen defined with a xml file that has buttons. I just want to > > use a dialog screen button to change the value of one variable,. > > Following is the real myMethod. > > > public void setDrawShape(int drawshape){ > > DrawShape = drawshape; > > } > > Ah, sorry if I had taken your previously comment as an insult > incorrectly. I am correct in saying that setting that variable will > then affect which button is drawn in your onDraw() method? In general > mixing the xml layouts and programmatically defined layouts probably > isn't a good idea. Can you not give the view an id in the layout, > then use use getResourceById (or whatever) to get a reference to it? > In general you shouldn't need to architect things this way, but I > haven't used SurfaceView much so I may be a bit out of my element on > this one. I mean in the worst case scenario (which seems like a real > hack), you can always make this a static method and use a static > variable, but like I said, that's quite a bit of a hack. > > kris -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en