Archive for the ‘Android’ Category

Android + Nekohtml – the Naive approach

Friday, January 30th, 2009

Nekohtml zip includes a JAR file.

Naive approach:

Add the JAR to the build path, and hope for the best.

How:

  1. Quite simple, create a lib directory under the project, copy the JAR file.
  2. Add code that access the nekohtml:
DOMParser parser = new DOMParser();

Result:

Failed!

W/dalvikvm(  170): Unable to resolve superclass of Lorg/cyberneko/html/parsers/DOMParser; (115)
W/dalvikvm(  170): Link of class 'Lorg/cyberneko/html/parsers/DOMParser;' failed
W/dalvikvm(  170): VFY: unable to resolve new-instance 196 (Lorg/cyberneko/html/parsers/DOMParser;)

Android HTML parser

Friday, January 30th, 2009

Android API has a SAX XML parser. But, what do you do when you want to parse HTML?

The SAX XML parser will work great till it encounters an XML error, a mismatched tag as an obvious example. The parser will throw an exception. You can implement the warning and error functions, but it will not help, the exception will still occur, halting the parsing process.

Therefore, the only solution is to import an external HTML parser to Android.

I have searched, read, compared and decided to use NekoHtml . Not sure how the programming team selected the name, but looks like a strong implementation.

I will document all the steps I take to include this library, until the hopefully succesful outcome.

Step 1: Download NekoHtml from sourceforge

Fujitsu to offer Android related services

Friday, January 30th, 2009

First read the news at AkihabaraNews, Fujitsu are going to offer Consulting, training, Engineering services.

The press release is here [JP], with two upcoming seminars in February. (Too bad I will arrive to Japan only at the end of February and will not be able to attend these seminars).

As Fujitsu market the Android, it is not only for Mobile phones, but as an embedded platform for several services:Point of Sale, Office equipment… almost everything ;)

Brochure [JP] is here

2 Channel browser basic design – Nichan

Wednesday, January 28th, 2009

Below the Nichan (2Chan browser) basic design:

nichan-design

Google Code Project

Tuesday, January 27th, 2009

Nothing much, but I have just created the Google Code Project for the 2Chan browser, located at: http://code.google.com/p/nichan-browser-android/

Still a mere place holder, but I hope to start Check-Ins in the next week.

Android 2Channel Browser

Tuesday, January 27th, 2009

Have just started developing a 2Channel browser for Google Android. This project will be developed as open source, and will be available at the Android Market for free.

The inspiration came from different Linux 2chan browsers as Kita2 and JD 2ch (both available for Ubuntu, using Synaptic), as well as Gikolet.(J2ME)

It is still not decided if I will reuse any of the code mentioned above. Kita2 was written in Ruby, Gikolet in Java but looks like the porting effort will be more difficult than rewriting it.

Stay tuned for this project progress as I expect I can provide a prototype in a few weeks.

Android View API inconsistency

Sunday, January 25th, 2009

Have just noticed that View.invalidate API is different than View.postInvalidate.

If I understand this correctly, functions should be very similar as they have the same goal of invalidating the view or a region, so how come invalidate can accept a Rect while postInvalidate doesn’t?

SIP stack for Android

Thursday, January 22nd, 2009

HSC has ported several communications stacks for Android:

  1. A SIP UA stack – MJSIP port
  2. RTP – jlibRTP port
  3. STUN – from jSTUN

Embedding SIP functionality into your Andoird application is now easier.

Link to HSC download page

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 0×01 (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.