On Wed, Jan 11, 2012 at 9:36 PM, JamesColeman <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

