Home


This site includes academic coursework, my resume, and projects I have done for work. This also serves as a place to post code and other programming-related information that I have found useful.

I also offer professional web development services for individual and small businesses.

How to generate a Google Maps API key for DEBUGGING only (Android) Share

October 24, 2010

  1. Locate the path to the keystore
    1. In Eclipse, navigate to Window | Preferences | Android | Build
    2. Under "Default debug keystore" you will find the path to the keystore
  2. Open a command prompt
  3. cd C:\Program Files\Java\jre6\bin (or wherever your java installation is)
  4. Run the command: keytool -list -alias androiddebugkey -keystore (path to keystore)\debug.keystore -storepass android -keypass android
  5. It should return something like: androiddebugkey, Sep 2, 2010, PrivateKeyEntry, Certificate fingerprint (MD5): XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
  6. Go to http://code.google.com/android/maps-api-signup.html and paste your certificate fingerprint and check the box to accept the terms (if you accept them of course)
  7. If all goes well, it will take you go a page that says: Thank you for signing up for an Android Maps API key! Your key is: (your key)
See also:

Comment

 

Changing Workspaces in Eclipse (Android) Share

October 23, 2010

For work I have to do a small presentation on programming for the Android phone.  (See: http://armyso.blogspot.com/search/label/Android) Well today, I wanted to make sure all my files were in C:\Users\Public because when I do the presentation I want to do it under a separate user on my computer just so that my coworkers don't see anything personal on my computer. I'm always weary of mixing work and personal stuff so this is to make me feel better about it. Anyway Eclipse doesn't like you just moving stuff, but I did anyway. In my Package Explorer all packages were messed up because I had moved the locations. To fix:
  1. Right click inside Package Explorer and click "Refresh". It will then say something about not finding the files or whatever, so just delete it (don't check the option for deleting from the hard drive). If you don't see the Refresh option that means that you have a Package selected. To unselect the Package press Ctrl + click.
  2. To import your existing Projects, go to File | Import | General | Existing Projects into Workspace | Next
  3. Select the directory where your new Workspace is and click Browse and press Okay
  4. It will find all the projects in that directory, if it already exists in your Workspace you wont be able to import it (duh!)
  5. Click 'copy projects into workspace' and click Finish
Before I did this, I had to change where it was pointing my Workspace, which isn't as straightforward as it should be.
  1. Go to C:\eclipse\configuration\.settings (or wherever your program file for Eclipse is)
  2. Edit the file org.eclipse.ui.ide: RECENT_WORKSPACES
To move the actual files, I just moved them within Windows Explorer

Comment

 

Hello again Android :p (Android) Share

October 17, 2010

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.

Comment