Saturday, October 30, 2010

Last Android Class Notes

Additional Information Available on:
Cal Poly Web Site with Android material: https://sites.google.com/site/androidappcourse/home
code.google.com/android
anddev.org
Look through Lunar Lander example for sprite manipulation and physics engine

Should know more java (basic concepts like):
Inner class, polymorphism
Note to self: look up Josh Block book - Intermediate & Advanced Java concepts

Adding Audio:
Add song.mp3 to res/raw/song.mp3 folder
Warning: filenames must be all lowercase! To solve, refactor all filenames.

For Video Viewing:
Use android.widget.VideoView
Play videos in mp4, etc.

Bringing up a web browser (Sample Code)
case 0:
Uri uri = Uri.prase("http://developer.android.com");
Intent inetnt = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
break;

Use Content Providers for Text Messages

Content Providers for Cameras and Camcorders
Always access via 'content://'
Needs a unique string identifying the content provider
Optional to have more than one data type
Optional to have instances of a given data type

Steps to create a Content Provider
1.) Create Provider Class (Includie a static final that defines your content uri)
2.) Create Properties
3.) Update Manifest

Underlying system is Linux based - use same formatting for locations (i.e. use all undercase)
To get external storage - from android.os
Environment.getExternalStorageDirectory()
Environment.getExternalStoragePublicDirector()

I also might be collaborating with some of my fellow classmates on projects outside of class!

Thursday, October 28, 2010

End of October

I had my physical yesterday. I'm red and green colorblind; this was confirmed when I was looking at a book of images containing colorful numbers and my reply to one of the pictures was, "Is that a butterfly?". I used to be 20/20 vision, but now I have a little bit of trouble seeing out of my right eye. I see better out of my left eye than my right. I blame my deteriorating eyesight on all the time I've spent on computers. (Been thinking about picking up a new monitor)

Speaking of which, I have one more Android class on Saturday. We've covered so much in a small amount of time (6 weeks?). The class sparked my interest in creating a startup programming company. Since my new job is only 32 hours, I'll be able to invest more time in other interesting projects. Right now I gotta resolve another "The application () has stopped unexpectedly. Please try again". Debugging sucks :(

My trip to Ecuador is coming up soon. I need to pick up snorkels and stock up on surf wax and sunscreen. Also need to review Spanish.

Halloween is just around the corner. This year I think I'll be a glow stick man.

Monday, October 18, 2010

Life is good! =)

Lately the weather's been terrible for surfing so I've been programming and studying.

Studying for the GRE is sometimes depressing as shit. Its simply rote memorization. I don't think its a good measure of determining intelligence; I think it emphasizes a little too much on a person's command of the English language and how much time they can afford to invest. I haven't been to school in over 5 years, but I've gone from scoring in the 1000's to the 1300's in the practice tests simply by putting in time. However, not everyone can afford to quit their job and study for a month.

Anyways, during one of my study sessions, I started wondering about what I could do with a Masters in Public Health. I started browsing for jobs around the area and found a position at Rady Children's Hospital as a Business Analyst. The position would analyze databases to do statistical analysis of health issues, demographics, etc. Hmmm.. I thought to myself, I might be able to do this job (other than the "minor" issue of not knowing any medical terminology). I applied anyway.

A week and a half later (on a Monday), I was surprised to get a call from Rady Children's Hospital. We talked briefly and they asked if I could come in the next day (Tuesday) for an interview. Shit, I didn't think I was going to get an interview; I don't even own a suit (with the exception of two wetsuits). I asked if we could schedule it for Wednesday. They agree.

I buy my suit the next day and come in Wednesday morning. During the interview, I find that the methodology for homeless data analysis is strikingly similar to medical data analysis (with the exception of the terminology and with one set of data lacking addresses). The interview lasted about an hour and by the end, I felt pretty confident. I was told that they would have their decision in the next week or two. As I leave, I see the next applicant entering in a suit. I'm glad I went and got a suit!

An hour later I get a call from Rady's. They want me back for a second interview... in a few hours later that day. I agree (and I'm really relieved because I don't have to buy another nice dress shirt). This time I'm interviewed by a whole staff of 7 people. They were a great group and seemed really passionate about their jobs, which in turn sparked my enthusiasm further. I simply love working with a group that wants to make a positive difference in society.

I'm surprised yet again because right after the interview, I get the job offer. It was so surreal. I think about it for a minute and accept. It was too nice of a learning opportunity to pass up so I'm deciding not to apply for graduate school yet (though I will take that GRE test in the upcoming months). Getting an interview, a second interview, and a job offer all on the same day (in this economy and for a position that I'm really interested in) must be a sign.

So other than studying (or lack of), I've been spending my time programming. My Android Development class has been going great. The instructor is very talented, especially in balancing academic theory alongside real world applications. I feel fairly confident in searching through reference code and applying it. I've been looking through Google's resource list and the amount of information is incredible, but time consuming. I find myself losing hours or days at a time sitting in front of my computer. I forgot how meticulously demanding programming can be.

My goal is to have a good, clean, and polished app out in the Market before Christmas.

Other than that, my friend James and I have our trip to Ecuador soon. I'll be gone from November 17th to December 7th. We'll spend 10 of those days on the Galapagos Islands! I'm very excited about the trip. We're pretty much going to bring a carry on bag with a few board shorts, a few shirts, a sweater, and a couple of towels. We'll buy surfboards there and sell them once we're leaving. I would like to brush up on my Spanish and learn some Salsa dancing before then.

Last, and certainly not least, I've been seeing an incredible person that makes me light up every time I see her.

Simply put, life is good =)

Saturday, October 16, 2010

Class 4 -Layouts


Concept: Tips on Layouts within Layouts
Tip: Make one change at a time, then check if it make sense? Does it do what I think it'll do?
Use background colors to check if layouts are acting appropriately with its properties; fill_parent, wrap_content.
The image on the left is two LinearLayouts (each with two buttons) within one LinearLayout (with vertical orientation). Notice Outline setup.


My thoughts on Android vs. iPhone vs Windows platforms:
There's currently three 'new' platforms for smart phone development; the iPhone, Windows, and Android.
  • The iPhone market is popular, but already saturated. As an indie developer, I wouldn't have the manpower to compete against thousands of experienced full time programmers.
  • Windows has a history of failure. There was a rumor that went around class that during the unveiling of the new Windows smart phones, the presenter attempted dialing a number only to have the 'blue screen of death' appear.
  • Google looks promising and has been gaining market share very rapidly, yet the Android Market is not (currently) saturated. It's also Google; you know a company's made it big when the name is being used as a common verb. I'm going to put my money on Android.

Monday, October 11, 2010

Class 3 -Moarrr Android!

Learned to create/navigate across multiple Activities, the Activity lifecycle, how to modify the XML using the GUI, and how to interact with the user.

Multiple Activities - The different 'pages' of the program. Each time a new page appears, its a new activity.

Modifying the XML using the GUI - Simple drag and drop interface.

Activity lifecycle - Need to read the state of the program. For example, if the program is still running while onPause(), the phone's battery will needlessly drain very quickly.

Interesting tidbit, the whole program re-renders itself every time the landscape is changed. We figured this out by setting up a count on our emulator, rotating the screen, and the count returned back to 0.

I like the humor of some of the Android creators. There's a public static int wtf(string, string) function, which stands for "What a Terrible Failure" and is used to report for an exception that should never occur.

Monday, October 4, 2010

Class 2 - Terminal Commands and my first App!

Learned some useful terminal commands, got into the basic GUI layout, created my first app, and uploaded it onto my phone. I'm picking up on concepts much quicker than I thought I would thanks to a very talented professor.

Terminal Commands:
  • android - Opens Android Standard Development Kit (SDK) and Android Virtual Device (AVD) Manager
  • emulator - Run emulator for devices
  • adb - Android Debug Bridge allows debugging, view logs, and shell commands
Flashlight App:
(I improved on the code by calling the screenBrightness function to increase the phone's brightness to max in case it's not. I've been browsing around the reference materials on developer.android.com and through stackoverflow.com; there is so much information/code. I'm just starting to realize the vastness and potential of open source)

package com.demo.android.flashlight;

import android.app.Activity;

import android.graphics.Color;

import android.os.Bundle;

import android.view.View;

import android.view.Window;

import android.view.WindowManager;

public class FlashLightActivity extends Activity {

//Tag testing: private static final String TAG = "Flashlight";

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

View view = new View(this);

view.setBackgroundColor(Color.WHITE);

// Get rid of title bar

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

//New - Added to increase phone's brightness levels to max brightness

WindowManager.LayoutParams lp = getWindow().getAttributes();

lp.screenBrightness = 1;

getWindow().setAttributes(lp);

setContentView(view);

}

}