Wednesday, July 14, 2010

App Inventor available for testing

There's a new tool in town that let's you create Android app in an instant.

Primarily designed for non-programmers, the tool can create apps with minimal code or non-coding at all.

Google has unvailed App Inventor on its Google Labs. It is currently available for beta testing. Filing an application to test is required.

View the demo below.

Saturday, June 12, 2010

Replica Island: Open Source Android Game

Recently bumped into an open source game intentionally developed for Android platform, which was started way back August 2009.



Replica Island is developed by an Android evangelist and Google employee, Chris Pruett. His blog discusses every little detail of the approach he did for this game. It would really be a good source of information about Android Game Development.

Get the source code at Google Code.

The game is already out in the Android Market so if you have your Android phone with you right now, I recommend that you try the game and see for yourself.

Wednesday, February 17, 2010

Where is the Color class?

Same case with Point2D, Java's usual Color class which should be under java.awt package could be found under Android's android.graphics package.

They needed to remove some functionality of the class thus came need to replace the usual Color class. Methods such as brighter and darker were removed.

JASAfA's Color class
Progress with JASAfA has been going smoothly. ActionScript's Color class is called which is accessible under ColorTransform flash.geom package. Likewise, JASAfA's Color class is accessible under droid.geom package.

Tuesday, February 16, 2010

Adobe AIR coming to Android Soon

In the currently being held Mobile World Congress in Barcelona, the Adobe Air Team previewed AIR applications running on Android and promised to bring Flash 10.1 in the first half of the year.

With Adobe AIR, developers can deliver rich and "more immersive" applications outside the mobile browser and across multiple operating systems. This will enable a write once and deploy anywhere solution for mobile and web applications.

Flash 10.1 will be completed within the first half of this year, while also including support for WebOS, Symbian, Windows Mobile and BlackBerry devices.

Friday, February 12, 2010

Alternative to Point2D

Given that AWT is not supported in Android API, the Point2D class, which is useful for writing 2D graphics, is missing either.

Point2D is traditionally accessible under java.awt.geom package but not dependent on the AWT framework so why was it not included in Android API? The answer is, Android have Point and PointF classes. Although among the two, PointF is my personal favorite.

Other Point class alternative
I've introduced JASAfA earlier, which happens to have another Point class which works like its ActionScript-counterpart. JASAfA's Point class is accessible under droid.geom package.

Java ActionScript API for Android

Introducing Project: JASAfA!

What is JASAfA?
JASAfA (or Java ActionScript API for Android) is a stupid name to a project that attempts to provide a Java framework for Android app development that tries to resemble ActionScript API. JASAfA (I know the name sucks big time, please suggest another) has nothing to do with Flash platform for Android nor Adobe. The project is free and open source, which is licensed under the MIT License.

Whom is it for?
Programmer who are coming from ActionScript world are mostly alienated by Java's API. This project is mainly for them. But could be useful to others as well.

Why write JASAfA?
With this framework, it is expected that any ActionScript coder could easily write Android app without the need of the Adobe Flash for Android. And with differences among Android SDKs, JASAfA will try to make sure same classes can be used across SDKs, keeping compatibility issues at a minimal level.

Where can it be downloaded?
The project page has just been setup and classes are being properly documented. Visit it once in a while at:

When will it be released?
Each classes will be released one after the other until all* has been written.

* Mapping the whole ActionScript 3 API will be a huge task. That is why, for the meantime the scope will only be:
  • flash.display.Graphics
  • flash.display.DisplayObject
  • flash.display.Sprite
  • flash.display.MovieClip
  • flash.events.Event
  • flash.events.MouseEvent
  • flash.events.KeyboardEvent
  • flash.geom.Matrix
  • flash.geom.Point
  • flash.ui.Keyboard
  • flash.ui.Mouse
Since this is open source project, anyone is invited to contribute other ActionScript classes that is not listed above.

Thursday, February 4, 2010

How to Speed Up the AVD

This tutorial will teach you how to speed up the android emulator.

A disclaimer though. After doing this configuration, do not expect a lightning fast AVD. This will possibly cut 1 to 2 minutes of boot up time depending on your computer specification.

With that said, do the following:
  1. On Eclipse, click Run -> Run Configurations.
  2. Under Android Application, select your current active project (ex: HelloWorld)
  3. Click on the Target tab.
  4. Under Additional Emulator Command Line Options, type-in -scale 0.5 -no-boot-anim
  5. Click Apply and you are done.

No Boot Anim
Setting the No Boot Anim flag will turn of the boot animation. Thus removing the loading of the images used in the animation, the delays used to have a smooth animation, and the transition to and from boot animation.

Scale
Ideally speaking, setting the scale to 50% will lessen the graphic rendering 50%. It might help just a little, but every milliseconds count if all you wanted is to test your app.

With that set, your emulator should look like this.

3 Things You Need To Know About Android SDK

Android uses Dalvik
Dalvik Virtual Machine is a minimalistic implementation of the Java platform. Android apps are written in Java programming language but it is being compiled to a format that Dalvik could understand -- the DEX file, or the Dalvik EXecutable. This DEX format is the output of compiling Java .CLASS files -- not Java source codes.

J2ME won't run on Android
Your J2ME experience will be relevant to writing Android apps, but your J2ME apps won't run on Android. Dalvik VM implements a different set of Java API for mobile -- think of Java and J++ as you think of J2ME and Dalvik.

SDK uses Qemu
Qemu is a virtual machine that emulates a real machine and boots up a guest operating system inside your computer -- in this case, it's the Android OS that gets executed. This basically answers why after pressing Ctrl+F11 on Eclipse, the emulator takes so long to display your running your app and sometimes unresponsive.

Saturday, January 30, 2010

Writing Your First Android App: HelloWorld

Most first time Eclipse users will be wondering how to create their first Android project. This tutorial will give you the steps on how to.

Creating Android Project
  1. Launch your Eclipse, if you haven't already.
  2. Click on File -> New -> Other... or simple press Ctrl + N on your keyboard.
  3. Toggle Android then select Android Project then click Next.
  4. Specify the following:
    • Project name: HelloWorld
    • Build Target: Android 2.1
    • Application name: HelloApplication
    • Package name: org.droidtutorials
    • Create Activity: HelloActivity
  5. Click Finish to create the project.
Correcting the X mark
  1. If you get this X mark on your project folder, do this extra step.
  2. Go to Project -> Properties.
  3. Click Apply, then click OK to close the Properties dialog.
  4. The X mark should be gone now.
Compiling and Testing HelloWorld
  1. Click Run -> Run or simply press Ctrl + F11.
  2. Select Android Application then click OK.
  3. Wait for your emulator to initialize so your App will be installed and running. Below shows the stages that the emulator goes to before finally loading your HelloWorld application.


 

If you could notice, I have waited at least 3 minutes to finally see my app running on the emulator.

That's it for now. Next part, we will discuss the files of a default project.

How to Setup Development Environment

Downloading the Tools.
  1. Download Android SDK r4.
  2. Download Eclipse Classic 3.5.1.
  3. Download Android Development Tools 0.9.5.
Installing the Tools.
  1. Extract the SDK at your root directory (ex: C:\)
  2. Extract Eclipse and run eclipse.exe
  3. On Eclipse, click Help -> Install New Software.
  4. Click Add... button, Add Site dialog will pop-up.
  5. Click Archive... button and browse for ADT-0.9.5.zip then click OK.
  6. Specify ADT as Name then click OK.
  7. Toggle-on Developer Tools then click Next to install.
  8. Now set the path of the SDK. Click Window -> Preference. Select Android, and set the SDK Location to: C:\android-sdk-windows, then click OK.
    Installing the Android API.
    1. With the SDK path set, click Window -> Android SDK and AVD Manager.
    2. Select Available Packages. Then toggle-on the following:
      • Documentation for Android 2.1, API 7, revision 1
      • SDK Platform Android 2.1, API 7, revision 1
    3. And optionally, toggle-on:
      • Google APIs by Google Inc., Adroid API 7, revision 1
      • Usb Driver package, revision 3
    4. Click Install Selected then accept the license and click Install Accepted.
    Creating Android Virtual Device (AVD or what we call Emulator).
    1. Again, click Window -> Android SDK and AVD Manager.
    2. Specify the Name (ex: MyAndroidEmulator)
    3. Choose Android 2.1 - API Level 7 as the Target.
    4. On Hardware, click New and OK repeatedly until all Properties has been added.
    5. Click Create AVD.
    Now you can start writing Android Apps!