Hello again Android :p

 
Body: 

This will be a stream of consciousness post as I am going through this book....

Emulator/Testing the App

Wow testing my Android app on my phone is extremely easy... I plug in the phone, select usb debugging and it'll automatically run on the phone.

When you first open the emulator, it takes forever to load... This would be a good time to put my laundry away lol. Okay it should only really take 2 or 3 minutes to load, so something was wrong with my project, so I just deleted it and started over (I hadn't coded anything for it yet anyway). Then the emulator loaded within a couple minutes. It took about 5 minutes for it to load up all the way and to show the app, so if yours is taking way longer than that, there's something else wrong. I think the problem was I hadn't closed my first project "HelloAndroid" before running this, so I think it got confused. I'm new at this so I could be wrong and this is my first time using Eclipse.

To make the emulator rotate, like when you rotate your phone, press Ctrl+F11. It'll rotate the entire thing to begin with, and it'll take few seconds to look right.

screenflip
screenflip

wait a few seconds...

Colors

I saw this code in the book:

#3500ffff

I was confused because I had never seen a value like that before. With web development, I'm used to seeing #RRGGBB. Why was there an extra 2 digits? Turns out that is to specify Alpha (I'm not sure what that is exactly, you can view the wikipedia article on it, but I think it has something to do with transparency). AARRGGBB

http://developer.android.com/guide/topics/resources/color-list-resource.html

Syntax

"The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource" http://developer.android.com/guide/topics/ui/declaring-layout.html#id

Error Messages

I gotta say, I love the error messages so far. Most of learning something like this takes place when you have to debug. The error messages are very descriptive and tell you what is wrong.

Example:

   android:id="@id/new_button"

   android:text="@string/new_game_label" 

Error: No resource found that matches the given name (at 'id' with value '@id/new_button').

Fix: I forgot to include the + symbol which defines a new resource.

Tags: 
randomness