Archive for January, 2009

First Android Application

Thursday, January 22nd, 2009

Just completed my first project with Android Platform.

I ported Moblica‘s Snaptu application from J2ME to Android. The guys at Moblica did a great job keeping the interface as open as possible, thus the port to Android was not that difficult. Most of the challenge was to adapt the code to Android Model of activities and API.

The Android application is still in alpha, thus only selected users get to test it, but expect it in the Android Market soon.

In the meantime make sure you check out Snapu , these guys are good (and happen to be my friends).

Snaptu on Android

snaptu-weather

Opening a Browser from an Android application

Tuesday, January 20th, 2009

As always, there is more than one way to do it:

1) Easiest- by Embedding URLs in the application. In your TextView field, set the android:autolink to 0x01 (web).

2) Firing an Intent РstartActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))  Рurl is a String, and since startActivity is called, then obviously the context should be an Activity.

A comment on API changes: Google keeps changing the APIs, if you search Google Groups you may find a reference to ContentURI, now obsolete or other methods. So, keep looking till you find the most updated reference.

Android: Getting ARGB from a JPEG

Thursday, January 15th, 2009

With J2ME, “Opening” a JPEG into an ARGB array may look like:

Image jpegImage = Image.createImage( jpegByteArray, 0, arrayLength );
if (jpegImage == null) {
//ERROR
} else {
jpegImage.getRGB (argbArray, 0, jpegWidth, 0, 0, jpegWidth, jpegHeight);
}

Since Android does not have an Image class, the following code will produce the same results (Please note the similar API):

Bitmap jpegBitmap = BitmapFactory.decodeByteArray(jpegByteArray, 0, arrayLength);
if (jpegBitmap == null) {
//ERROR
} else {
decodedBitmap.getPixels(argbArray, 0, jpegWidth, 0, 0, jpegWidth, jpegHeight);
}

Not that different, isn’t it?

(And I know I need a better blockquote for code… working on it)

Android Activity and Networking

Wednesday, January 14th, 2009

Google has selected a new model for the Android User Interface: The Activity, which is tied to User-Interface.

Now, when someone (like me) intends to implement a UI with some  networking threads and processing, the two options are:

1) Running the Networking as a Service

2) Spawaning threads from the UI activity.

The two options are not that bad, it is just that using a Service model is an overkill for most applications, and having one activity which manages everything – UI as well as tasks seems like the easier solution.

When I started, I assumed an Activity can be anything, but as clearly stated:

(an activity that is not visible to the user and has been paused) is no longer critical, so the system may safely kill its process to reclaim memory for other foreground or visible processes

Sorry for not posting code, but this project is not an Open Source.

Japanese Open source

Wednesday, January 14th, 2009

I follow on twitter some Japanese bloggers, Open Source advocates, which allows me to get a glimpse to the Japanese Market. I found it sometimes amazing, how many original ideas are out there.

A few examples:

  1. twigadge – A twitter sidebar
  2. termtter – Command line twitter client, written in Ruby.
  3. nicodown – From the same guy who wrote 2, a C file that connects and downloads video from the Japanese Nico Nico Douga website. In his website you can locate a few more handy python, perl and ruby scripts as well as a development blog (Japanese)
  4. http://xa.yuiseki.net/ – Exteme Adhoc is the name of the website, and it is indeed extreme, you can follow schedule, twitts, locations, photos of several guys

Pidgin MSN update – Connected

Monday, January 12th, 2009

Pidgin has just managed to connect to the MSN network. I wonder if we will ever get an explanation what happened.

Android Progress

Monday, January 12th, 2009

The Android application is coming along nicely, networking works perfectly.
But! As I am migrating a J2ME application, I am having difficulties translating the J2ME design to the Android activities.
Will explain more once I decide

Pidgin update – Still doesn’t work

Monday, January 12th, 2009

Pidgin still cannot connect to MSN network.
Have tried to connected via a web browser, but apparently MS do not support the browser I am using (Firefox 3.0.5 on Ubuntu), and Meebo connected for a while, but after about 5 minutes disconnected claiming there was an error or I connected on another machine (yeah, I wish).

Pidgin fails to connect to MSN Live messenger network

Monday, January 12th, 2009

Is it seems that Adium as well as Pidgin fail to connect to the MSN live messenger. Hope this will be resolved soon.

Is this just a BUG, or was this planned by Microsoft?

Anyway, if it is not resolved, I’d have to move all my contact to XMPP as Live Messenger does not support Linux.

Android Rules!

Thursday, January 8th, 2009

As more and more Android news are added every day:

1) SkypeLite for Android

2) Windriver showcases Android on Qualcomm’s Snapdragon (What a strange name, isn’t it).

And as I am gaining more experience with the Anroid OS and Application API, I am convinced Android is THE next OS for Cellular phones and MIDs! Not even one doubt in my mind.

Symbian

Became a very strong player in the Cellular phone business, but had no plan going into the MIDs. Symbian is not bad, but the new OS (iPhone and Android) are more “sexy”, and I will not be surprised if number of application developed for iPhone and Anroid already surpassed the number of Applications developed for Symbian.

Linux for Mobile Devices

There are a few examples, but too few.

Windows mobile

Will keep the Market share in the next year or so, just to see Anroid getting stronger.

iPhone

It is nice, but the API is closed, and what appeals to me and MID vendors is the opennes and how easy it was to port the Android to other platforms.

Are you convinced?