Doughy wrote: > I am trying to create a very simple program that will change the text > of a label object when I click a button. I have created the button > and the label using the XML file, but now I have no idea how I can > write the callback when the user presses the button.
There are hundreds of sample activities that came with your SDK, in the samples/ directory, and a few dozen have buttons. If you look at one of them (such as Visibility1.java), you will find statements like: visibleButton.setOnClickListener(mVisibleListener); where visibleButton is a Button and mVisibleListener is: OnClickListener mVisibleListener = new OnClickListener() { public void onClick(View v) { mVictim.setVisibility(View.VISIBLE); } }; The general Android rule of thumb is that event processing is either handled by a listener (e.g., OnClickListener) or via callback methods you can override in a subclass (e.g., onCreate() in an Activity). -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---