Posts Tagged ‘Android’
Posts that contains tutorials and information about Google’s OS, Android.
Android: Fixing the API 12 Demos project errors
Posted by Dimitri | Filed under Programming
This post shows how to fix some of the most common errors when creating a project with the API 12 (Android 3.1) demos in the Eclipse IDE. The API samples comes bundled with the Android SDK and are a set of Activities that exemplifies how to do almost anything in Android. Following the instructions described at the official documentation to create a new Eclipse project with the API demos 12 code will cause a lot of errors.
Android: Disabling anti-aliasing for pixel art
Posted by Dimitri | Filed under Programming
Android is great when it comes to displaying scaled pictures in applications and games since it tries to interpolate the pixels, making the resulting image look as good as possible. That works for almost every case, however, what about pixel art? This behavior isn’t good for that because, after scaling it, the resulting image will be “smoothed out”, invalidating the handcrafted pixel placement.
There are two options in this case: use an image with the correct size and never scale it, or try to disable anything that could be aliasing the image. This post is going to describe how to do the latter. As usual, an example project is available for download at the end of the post. (more…)
Android: Transparent or Translucent View Background
Posted by Dimitri | Filed under Programming
This Android post is going to explain how to change the background color of a View, to make it completely or partially transparent. It may seen a little strange at first, but sometimes it makes sense to create a translucent or transparent background, like when coding an application with multiple viewports, such as a graphic editing tool, for example. Luckily, Android has already some built-in features that aids the programmer in achieving total or partial transparency at any required level.
So, to create a fully transparent background, all that’s needed is to add the following line to the Manifest file: (more…)
Android: Detecting Double Tap Events
Posted by Dimitri | Filed under Featured, Programming
This Android tutorial explains how to create an Activity that “listens” to double tap events. Doing that isn’t as trivial as getting a single tap from the screen, however writing a code that registers when the screen has been touched twice isn’t complex either. The example featured in this post works on the emulator and on a real Android device.
To implement the double tap, some classes and interfaces are going to be needed, but it’s best to show the example Activity code before explaining each one of them: (more…)
Android: reading float values from a XML file
Posted by Dimitri | Filed under Programming
When programming an Android app, data such as integers, drawables and strings can be loaded from XML files through the Resources class, using their automatically generated IDs. But a float can’t be placed in these XML files, since the Resources class won’t generate IDs for it. This post will focus on explaining how to load a float, and some other values from a customized XML file. All code featured in this tutorial is available at the end of the post.
It’s worth mentioning that this example uses the XmlResourceParser class (a XML pull parser) to read the contents from a XML file. This is just one of the three available methods of retrieving the contents of a XML file in Android. That being said, the first thing we are going to need is the XML file. (more…)