Hello, I'm new with Android and am trying to build a simple Flashlight
program.  I've built a basic layout with two buttons, ON and OFF.
There are two onClockListeners defined, one for each button.  Here's
an example of what the OnClickListener does for the ON button:

        final Button on_button = (Button) findViewById
(R.id.on_button);
        on_button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
          //    turn on the light
                setContentView(R.layout.on);
            }
        });             //      end setOnClickListener

The OnClickListener for the OFF button is very similar, save that, for
example, the setContentView takes as a parameter R.layout.off.

I've defined two .xml files, one for R.layout.on (all white), and one
for R.layout.off (all black).  The idea is that by clicking one of the
two buttons, the respective xml file determines what the user sees.

Before I dig too deep into this approach, is there a fundamentally
different way I should be thinking about this problem?  Again, I'm a
newbie, but eager to learn.

Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en

Reply via email to