Tseng’s dev blog

A developers blog


Archive for the 'Programming' Category



Android 1.5 NDK Released!

Thursday 25 June 2009 @ 9:22 pm

Finally Google Released the NDK, which allows developers to use native code/libraries in their code (programmed in C or C++) which can be used for intense CPU operations such as encoding/decoding or physics.

You can download it here.

For most Developers this isn’t much interesting, but if you need advanced stuff as implementing your own audio and video codec, you may want to try it out.

Source: Android Developers Blog

Bookmark and Share



SavedState: Preserve data when your Activity is recreated – Part 1

Friday 27 February 2009 @ 11:07 pm

One difference to between conventional programming and Android development is that the Android OS can at any time kill your Activity if it runs low on resources or in certain other conditions like configuration changes.

This can be very critical when it comes to data. On such an event, there is a possibility that data loss will occur and as programmer you want to avoid that under any circumstances.

Most of the standard widgets like EditText already preserve their state under certain circumstances. By default widgets/UI elements with an android:id attribute defined, will by default preserve their states when the application is destroyed and recreated.

But what if the you need to preserve data defined inside of your Activity or your own widgets?

Continue Reading »
SavedState: Preserve data when your Activity is recreated – Part 1

Bookmark and Share



How to implement your own Listener in Android/Java

Tuesday 17 February 2009 @ 8:31 pm

When you’re developing application, there is often a need to create your own controls/widgets/classes or to extend already available ones. And in most cases, you want this control/widget to be as flexible as possible. In order to achieve this, you have to create special events, which can be handled outside of your widget.

Some of the popular examples are OnClickListener and OnKeyListener. But sometimes you need Events/Listener which aren’t predefined by the Java or Android SDK. In this case, you have to create your own Listener interface.

In the last post, I’ve shown three different way on how to implement Listeners in your application. Now I’ll show you how to implement your own Listeners.

Continue Reading »
How to implement your own Listener in Android/Java

Bookmark and Share



Implementing Listeners in your Android/Java application

Saturday 14 February 2009 @ 4:18 pm

I’ve seen many people asking how to implement Listeners in their applications. Implementing a Listener is quite easy. There are 3 ways to implement an Listener and the have their advantages and disadvantages.

The tree way to implement Listeners are

  • Inline Implementation
  • Using the implements keyword
  • By using variables

We’ll use our good old LoginExample application, created in previous tutorial which can be found at Android: Your first Android Application.

Continue Reading »
Implementing Listeners in your Android/Java application

Bookmark and Share



Android: Creating XML UIs

Friday 30 January 2009 @ 2:31 am

In the last article, Android: Your first Android Application, we created a simple login screen, but didn’t had time to go in deeper in the UI XML structure. In this article I will explain the basics of creating an UI via XML resource. I’ll use the XML file from previous example here.

Continue Reading »
Android: Creating XML UIs

Bookmark and Share



A sad day for Handsets: Apple awarded with Multi-Touch patent

Thursday 29 January 2009 @ 5:18 am

A few days ago, Apple was awarded with the patent #7,479,949, titled "Touch screen device, method, and graphical user interface for determining commands by applying heuristics". In other words, this means that there won’t be any handsets with Multi-Touch devices out of there other than Apple devices, at least in the U.S. This is especially also a bad day for Google and their Android OS, as it was one of the most promising competitors to Apples iPhone on the handset market.

The patent is a long and detailed description of the technology and was filled on April 11, 2008:

A computer-implemented method for use in conjunction with a computing device with a touch screen display comprises: detecting one or more finger contacts with the touch screen display, applying one or more heuristics to the one or more finger contacts to determine a command for the device, and processing the command. The one or more heuristics comprise: a heuristic for determining that the one or more finger contacts correspond to a one-dimensional vertical screen scrolling command, a heuristic for determining that the one or more finger contacts correspond to a two-dimensional screen translation command, and a heuristic for determining that the one or more finger contacts correspond to a command to transition from displaying a respective item in a set of items to displaying a next item in the set of items.

This can also mean the end of the Palm Pre which supports swiping and pinching.

Originally at World of Apple.

Bookmark and Share



Android: Your first Android Application

Thursday 29 January 2009 @ 12:32 am

So, you finally want to make you first Android Applications. But don’t be scared, we won’t start with the "Hello, World!" application usually used to introduce you into a programming language, but will start with something more useful: A login screen.

If you haven’t setup the SDK & Eclipse yet, you should first read my previous "Android: Installing the SDK" post and then come back.

All of the guides and examples are written with the Eclipse IDE. If you’re using another IDE, you have to check for appropriate menu/shortcut/etc options in your IDE.

First we create a new project by selecting the File menu -> New -> Android Project or right-clicking the Package Explorer -> New -> Android Project.

Continue Reading »
Android: Your first Android Application

Bookmark and Share



Android: Installing the SDK

Friday 2 January 2009 @ 3:26 pm

Before getting started, you first need to download and install the Android SDK. But first, if you meet the requirements.

In order to use the Android SDK, you need to have JDK 5 or JDK 6 installed on your system (JRE alone won’t do it!). Next you’ll need an IDE (it’s optional, but makes developing much much easier than writing all your code in a simple text editor). I suggest using Eclipse 3.4 together with the Android Development Tools for Eclipse.

Continue Reading »
Android: Installing the SDK

Bookmark and Share



Android: Introduction

Wednesday 17 December 2008 @ 3:34 am

On October 22, 2008 the first Android capable handset was released, the T-Mobile G1.

You may now ask yourself "What is Android?". Android is an open source  framework designed for handsets and developed by Google, similar to Apples iPhone. It includes an operating system, middleware and key applications.

Continue Reading »
Android: Introduction

Bookmark and Share