3.18.2009

First App: Demo1

I've successfully written an Android App. It's not much, it simply presents the user with a word, and allows the user to change its color. Of course I added a few options and details to make it more interesting, but at its best it's not very useful.

What is useful however, is understanding how an Android program works. For example, to create a simple button one must define the attributes of the button in XML, then tell the Java code where the button is, what the button is called and again what to do with the button.

Here's the meat of my code:
// Generate some random numbers for a color
Random(System.currentTimeMillis());
num_Rnd_r = m_rnd.nextInt(255); // 255 is the upper limit
etc...

// I then color the text with my numbers using RGB
txt_Color.setTextColor(Color.rgb(num_Rnd_r, num_Rnd_g, num_Rnd_b));

When the menu button is pressed, options appear allowing the user to: edit the text being colored, start over, or hide the details (button tap count & RGB values).