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 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.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.

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.