Wednesday, March 3, 2010

Android NDK installation problem

Today I decided to install android NDK 1.6 . First of all I downloaded Cygwin and installed the Base package and Developer package (without the Developer package you can't use NDK). I recommend deeply the default instalation folder(C:\cygwin), but should you chose another instalation folder check if the path contains spaces. If it does you may experience some problems later. After I installed Cygwin, I opened a Cygwin terminal instance (cygwin_instalation_folder\cygwin\Cygwin.bat). From here I used cd and ls commands to navigate to the folder. Then I typed "./build/host-setup.sh" and got this ugly error.

CC : compiler check ok (gcc)
LD : linker check ok (gcc)
CXX : C++ compiler check ok (g++)
Generate : out/host/config.mk
Toolchain : Checking for arm-eabi-4.2.1 prebuilt binaries
ERROR:
It seems you do not have the correct arm-eabi-4.2.1 toolchain
binaries.
Please go to the official Android NDK web site and download the
appropriate NDK package for your platform (windows).
See http://developer.android.com/sdk/index.html
ABORTING.


I googled it and found basically nothing. The problem was the path where I extracted the NDK archive: "C:/Users/MyUser/My Documents" contains a space character. After I moved the folder directly to C: the error was gone.


$ ./build/host-setup.sh
Checking host development environment.
NDK Root : /cygdrive/c/android-ndk-windows
GNU Make : make (version 3.81)
Awk : awk
Platform : windows
Generate : out/host/config.mk
Toolchain : Checking for arm-eabi-4.2.1 prebuilt binaries

Host setup complete. Please read docs/OVERVIEW.TXT if you don't know what to do.

Friday, November 6, 2009

KeyboardView problem

A few days ago I tried playing with KeyboardView to make my own virtual keyboard for a little application. I had a big surprise which cost me a couple of hours (around 4-5). I even posted an issue here. Nothing special happened and no one responded to my post. I took the matter into my own hands and tried again different ways. I managed to locate the bug: THE CONTEXT. You cannot create a KeyboardView using the application context. You HAVE to use the Activity context. The developers from Android SDK said "they HAD to make the application context, but it doesn't really do anything" !? Maybe they SHOULD have warned the developers about the RISKS of using it. And by the way, if you use the Activity context and manage the orientation change event you WILL experience the memory leaks and the application crash.
So kids, do not play with Context at home. And if you do choose carefully whether to have memory leaks or to create your own KeyboardView (or maybe better, your own Android SDK).

Sony Ericsson Xperia X10 skin

It seems that Xperia X3 from my previous post is actually called X10 and it's indeed a new Android phone. You can find all the details here. I don't know when we will be able to buy one but if you're an Android developer you can at least use Xperia X10 skin on your emulator. The skin supports Android SDK 2.0 and you can download it from by clicking here. If you don't like it, you can find out other skins here.

Monday, November 2, 2009

Sony Ericsson Xperia X3 surprise





So there are about 24 hours left until Sony Ericsson comes up with news on Xperia X3 (also known as Rachael). There are some leaked pictures and technical specifications on the web but we can't get excited until tomorrow. But if the rumors will be confirmed this is going to be a hell o' a phone:
- OS: Android
- Processor: 1GHz Qualcomm Snapdragon
- Camera: 8 mega-pixels
- HSDPA (10Mbps)
- HSUPA (2Mbps)
- Navigation: AGPS
- Audio connector: 3.5mm (which is pretty cool)

With a little bit of luck in the near future we will be able to run Windows XP on a mobile phone using a virtual machine. All we need is a little bit of RAM and processor which supports visualization. Until then we, the mobile enthusiasts, will run XP on PCs and notebooks like normal people.

Sunday, November 1, 2009

AnimationDrawable problem

You may encounter a big problem when playing with an AnimationDrawable object in Android: it won't start! Actually it will remain blocked on the first frame and it will confuse you why it didn't start moving. So you may lose this way a couple of hours just trying to find where is the problem. The code seems to be okay, you did something like this:

public class Present extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout l = (LinearLayout) findViewById(R.id.main);
AnimationDrawable d = (AnimationDrawable) getResources().getDrawable(R.drawable.myanimation);
d.setBackgroundDrawable(d);
d.start();
}
}

I saw a couple of people complaining on forums but no one answered to their problem.
Now the catch is that no UI object is created until the onCreate function call is terminated. I assume that android internal framework doesn't start rendering the UI after setContentView, but it waits for the onCreate to terminate then it starts showing all the graphic elements. So what you need to do is call "d.start()" after we get past onCreate. Though I'm not saying it's the best solution, here is a little workaround:

public class Present extends Activity{
class AnimationStarterThread extends Thread{
private AnimationDrawable myAnimation;
public AnimationStarterThread(AnimationDrawable ad)
{
myAnimation = ad;
}
public void run()
{
ad.wait();
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
ad.start();
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout l = (LinearLayout) findViewById(R.id.main);
AnimationDrawable d = (AnimationDrawable) getResources().getDrawable(R.drawable.myanimation);
d.setBackgroundDrawable(d);
AnimationStarterThread ast = new AnimationStarterThread();
ast.start();

//do other initialisations

ad.notify();
}
}


It's very far from an elegant solution. If I'll find a way to hook the event of UI post-initialization(this is the way to do it) I'll post an update.

Friday, October 30, 2009

Android 2.0



Android 2.0 is out! New features are available for developers and of course for the users. First of all let's start with the users news:

- you can add multiple accounts on a device for email and contact sync
- you can search for all SMS and MMS messages
- you can set the device to auto delete the oldest messages when a defined limit is reached
- built in flash support, digital zoom, scene mode, white balance, color effect, macro focus for the camera
- the new virtual keyboard makes it easier to hit the correct characters and improves writing speed
- double tap zoom, bookmarks with web page thumbnails, support for HTML5, database API, geolocation API inside the browser
- Bluetooth 2.1 with Object Push Profile (OPP) and Phone Book Access Profile (PBAP)

For the developers we have:
- new emulator skins
- debug/release application signing
- Bluetooth on/off, device and service discovery, data exchange via RFCOMM
- account manager for user/pass storing
- new parameters for color effect, scene mode, flash mode, focus mode, white balance, rotation, and other settings and ZoomCallback interface for Camera
- new API for retrieving image and video thumbnails on demand
- new system themes in android.R.style
- new WallpaperManager API
- new Service API
- advanced features for MotionEvent and KeyEvent

I saved the best part for "le grande finale" : Android 2.0 has the long expected multi-touch feature which will support up to three fingers touch simultaneously.

You can find a diff report here. And for more information about the release try here.

Halloween King of Lines

King of Lines is available now in "Halloween edition" on Android market. We will continue to make this game even better on future releases. If you want to propose new features please do so.




King of Lines Halloween edition