Thursday, 23 June 2011

A dictionary of new words (kind of)

English is a massive language. The Oxford English Dictionary, Second Edition has about 600,000 words in it and that doesn't include the similar number of technical and scientific terms that aren't listed.

In the early days of the language's evolution the mass of words was helped along by England having an influx of peoples and languages from many lands and this helped grow the number of different terms for the very same thing.

Tuesday, 21 June 2011

Podcast on “Project Cooper”

I recorded a podcast recently for RemObjects, and was interviewed by their technical evangelist Jim McKeeth. We talked about various things including Java, .NET, Mono and Mono for Android, but the chat was mostly focused on “Project Cooper”.

You can find the podcast on the RemObjects Radio site.

Saturday, 11 June 2011

Fun & games with OpenGL on Android

I've been working up some demos for Project Cooper to show it working well with the Java class libraries and with the Android SDK. Most recently been trying my hand at getting some OpenGL demos going. I've briefly bumped into OpenGL over the years, but have by no means become a dab hand at navigating the mass of calls in the library and so have been finding the OpenGL documentation invaluable. To help me get something working I've been following steps in books and looking at demos found online.

One demo in a book I have involves a spinning cube (a popular type of demo), that has an image used to texture each side of the cube, and also makes the cube transparent. It's a nice looking demo for sure. I cobbled the code into a Project Cooper application and tested it out and was left very puzzled. You see, the demo ran just fine on the Android emulator. But on my shiny HTC Desire the cube had no bitmap texture on it - the cube was bare!

So the challenge was to find out why a well-performing physical Android device was beaten by the meagre emulator. The solution was found using logging, documentation, the Android source and some general web searching.

Wednesday, 8 June 2011

Decompiling Android package resources

Sometimes you see a screen in an Android app and you think to yourself: "I wonder how that layout was achieved..."

An initial thought, especially once you realise that .apk files are just ZIP archives, is to just pull the layout xml file out and take a peek. Alas this thought gets you not very far at all as the .apk has the constituent files encoded or tokenised or somehow made unreadable and unusable.

It turns out that apktool is the answer here as it can unpack the resources and decode them into original format so you can browse the layout (as well as the other packed resouces).

Don't forget to read the "Installation for noobs" section - I missed that to start witha and so got stuck for a while. However I'd put the two downloads into a a dedicated directory on the path, rather than the Windows directory, but that's a personal choice.

Delphi Certification is back

It's been a long time, but Delphi certification has returned for those who want to prove their prowess over the Win32 development tool.

If keen, your main port of call should be the Embarcadero Certification Center. Here you'll find information about the two levels of certification on offer.

Firstly there is the basic Delphi Developer Certification that tests general knowledge of Delphi syntax, programming techniques, the IDE and database development. Those who have a registered copy of Delphi XE or RAD Studio XE can take this certification test for free (if they request a test code before the end of July 2011 and use it within 90 days). For others it will cost $US49. It would be advisable to check out the Delphi Developer Certification Exam Study Guide before taking the test, which can be taken online.

There is also the Delphi Master Developer Certification, which tests more advanced knowledge of Delphi concepts, architecture choices, syntax, techniques, IDE, projects and groups, component use and development, client/server, Internet and multitier development. This test needs to be taken at a Certification Center and will cost $US149. There is also a Delphi Certified Master Developer Exam Study Guide to check out before taking the test.

Monday, 6 June 2011

More Android command-line fun

Following on from yesterday’s post about building Android apps at the command-line, this post looks at more things you can do with the command-line tools

You might normally start up an Android emulator (or Android Virtual Device) by running android.bat. This invokes the Android SDK and AVD manager, but unlike when you run SDK Manager.exe, it does not immediately connect to the network and update the list of available SDK packages. Instead it starts on the Virtual devices page and lets you create, edit or start an emulator.

Android SDK and AVD Manager

If you can remember the name of the emulator you want to start, say Android_2.2, then you can invoke it directly with:

emulator -avd Android_2.2

or, even simpler:

emulator @Android_2.2

Most interaction with the emulator or the device is done with the Android Debug Bridge (adb.exe). As mentioned in the last post, running adb devices will enumerate all connected devices and emulator instances and list out their serial numbers and connected state. Any emulators have the word emulator in their serial number to make it easy to spot them.

On occasion I've had problems with adb failing to notice an emulator that has been started up after initially working with a real Android device. This is usually overcome by telling adb to remove itself from memory and reload. adb acts like a daemon and normally stays running in memory between invocations, so to kill it you can use:

adb kill-server

The next time you run an adb command the daemon will be re-started. Note that killing the daemon also gets over problems where the adb in-memory process retains a handle on an Android package that's been installed. I've bumped into the issue several times, where trying to move or delete an Android project directory has been thwarted because something has a handle open on a file in the project directory tree. This often seems to be adb and killing it frees the handle.

Sunday, 5 June 2011

Android from the command line

Whilst working with Mono for Android I was pretty much confined to the IDE with regard to building apps and deploying them to the emulator or to a real Android device. That was quite important as Mono for Android had various non-standard additional steps to ensure all the pieces were in place, what with there being a Mono layer, and dependencies (at least with debug builds) on the Mono shared runtime and a platform-specific additional runtime.

Now that I’m working with Project Cooper, building native Android apps, I have the same luxury of choice as a Java developer. I can do everything in the development environment or drop to a command prompt (if in Windows, or a terminal on Linux or on a Mac, though to simplify things I’ll be assuming Windows) and do any amount of stuff from there.

I figured it may be an idea to run through the steps involved in turning a .jar file into an Android app, getting on a device or emulator, and starting it. In other words show a variety of Android-related commands that I’ve been using recently.