Thursday, May 15, 2014

Android Development

Android Development

Android Development

Introduction

It's been a while since anything productive has been done on this blog. Previously published articles went over AP computer science and then developed a Blackjack game to show how beginning computer science skills can be used to create a useful program. The new realm of programming has become the hand-held devices. There are 2 flavors Apple IOS and Google Android. If you have been following along in this Blog you know that Java has been studied in depth. The next logical step would be to investigate how to program in the new realm. Logically it would be nice to start with a platform that uses Java as the basis for application development. This forces the investigation down the Android path. Andriod is Java based while Apple IOS uses Objective-C.

Eclipse over Netbeans

For this project I have chosen Eclipse as the IDE. There are plugins for Netbeans but I don't want to favor one IDE over another. That's ultimately for the user to decide. I use both they both get the job done. They are both free so what's the big deal? Have both on your machine use whichever one you like best. For this project I installed the latest Eclipse Kepler. I then downloaded and installed the latest Android plugin for Eclipse. All of this development is being done on a Mac Book Pro with Java 7.

Android development is complex

Android runs on a small tablet computer but the complexity is anything but small. As a user you tend to think of an andriod app as a single unit, after all it all starts by tapping a tiny icon on the screen. But then android's complex Framework takes over. Android supports different handheld devices from phones to full size tablets. Android is also multicultural it tries to separate out human language strings into a separate area so that a program can be easily modified for use in another country. To facilitate these features Google has added a level of complexity to development. It's a bit daunting at first but as you become familiar with where things go you begin to see the logic behind it.

Android already has some tutorials

Android provides a large amount of tutorials. "Building your first App" should be glanced over (https://developer.android.com/training/index.html). The important point here is that you will need to download the Android SDK. Then install the Android plug-in for Eclipse. Once you have accomplished this, you're ready for that famous starting point of all software development.

Hello World

There was a time when you logged into your computer open a file and after typing in a few lines of code you saw Hello World typed back at you. Under andriod you need multiple files and a large directory structure to accomplish the same feat. Under Android there isn't a lot of typing but you get a huge project directory and multiple files just to accomplish the same thing.

  • TO Create the Hello World program under android:
    • File>New>Other>Android Application Project
  • This brings up the following dialog:

  • Type in your application name (change the package if you want).
  • Change the minimum SDK to be the latest SDK
  • Hit Next>Next>Next>Next>Finish

At this point you may or may not have some small issues. Try one or all of the following

  • Right click on the project and choose Android Tools>Fix Project Properties
  • Right click and refresh the project
  • In the project menu do a "clean" on the project

After one or more of these your project should be able to run in the emulator. I named my project BlackJack which is probably not the best name since the name is already taken in Google's Play Store. But for our purposes who cares we can rename it if it ever becomes of commercial value. The following screen shot is what you should get if you set up your project correctly:

Run your android app in the simulator

Just right click (Ctrl-click on Mac) on the top level of your project and select "Run As">"Android Application" You may need to run this twice. Once to start up the simulator and once to load and run your program.

Intel Hardware Accelerator

If you get a message that HAX is not working you need to go get the fix from intel for their hardware accelerator (see reference 1). The link is at: intel HAX After you install this the execution on a Mac should be smooth. Working like the tablet itself.

For the project created so far this is what you should see in the emulator:

Conclusion

There is a lot of configuration with this project that I assumed the average user should be able to work out for themselves. This Hello World version of BlackJack will be the scaffold for which we will start to piecemeal add the functions of BlackJack from the previous projects.

Author: Nasty Old Dog

Validate XHTML 1.0

1 comment:

  1. Android Application Development: http://online.wsj.com/community/groups/android-users-2080/topics/hire-android-application-development-company

    ReplyDelete