background preloader

Android

Facebook Twitter

Unzipping Files with Android (Programmatically) I wrote an article a few months ago, which walked you through the process of zipping files programmatically with Java - in an Android environment. Due to popular demand, I've decided to write up another article on how to unzip files. The process is pretty similar, and you could probably combine them both in a single class, but for this example, I made a class called Decompress. import android.util.Log; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * * @author jon */ public class Decompress { private String _zipFile; private String _location; public Decompress(String zipFile, String location) { _zipFile = zipFile; _location = location; _dirChecker(""); } public void unzip() { try { FileInputStream fin = new FileInputStream(_zipFile); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; while ((ze = zin.getNextEntry()) !

Here's an example of how to use it: Installing apps without the market. Zipping Files with Android (Programmatically) One majorly annoying issue that I stumbled upon, was the fact that I couldn't send multiple attachments using Intents to the Google Mail app. The quickest way around that was of course to compress all of the files into one (ZIP). After searching around online, I didn't really find much on zipping files on your Android device - most of the articles were for standard java applications, which assumed that all your files were in the current directory that you wanted to zip. So, I used what I could and whipped up my own wrapper class that allows you to easily zip files in Android! Here is the class: If that all makes sense to you already, then you probably won't be interested in my explanations below, otherwise, keep reading. :) private static final int BUFFER = 2048; private String[] _files; private String _zipFile; These are the properties that I've declared for the class. public Compress(String[] files, String zipFile) { _files = files; _zipFile = zipFile; }

Design - Design Principles. These design principles were developed by and for the Android User Experience Team to keep users' best interests in mind. For Android developers and designers, they continue to underlie the more detailed design guidelines for different types of devices. Consider these principles as you apply your own creativity and design thinking. Deviate with purpose. Enchant Me Delight me in surprising ways A beautiful surface, a carefully-placed animation, or a well-timed sound effect is a joy to experience. Real objects are more fun than buttons and menus Allow people to directly touch and manipulate objects in your app. Let me make it mine People love to add personal touches because it helps them feel at home and in control. Get to know me Learn peoples' preferences over time. Simplify My Life Keep it brief Use short phrases with simple words. Pictures are faster than words Consider using pictures to explain ideas.

Decide for me but let me have the final say Only show what I need when I need it. 31 Days of Android. How to have your (Cup)cake and eat it too. [This post is by Adam Powell, his second touchy-feely outing in just a few weeks. I asked him to send me a better picture than we ran last time, and got this in response. Photo by our own Romain Guy. — Tim Bray] Android developers concerned with targeting every last device with their apps are no doubt familiar with this chart: On July 1, 2010 this was the breakdown of active devices running different versions of the Android platform. With all of the new platform features added to the Android SDK in each version, this chart has many developers shouting the F-word when they are forced to choose between integrating newer platform features and providing their app to the widest possible audience.

Savvy Android developers already know that these two options aren’t really mutually exclusive, but that straddling between them can be painful. Several weeks ago we took a look at how to handle multitouch on Android 2.0 (Eclair) and above, and by the end we had a simple demo app. The problem manifests. Introducing Android WebDriver. [This post is by Dounia Berrada, an engineer on the EngTools team. — Tim Bray] Selenium WebDriver is a browser automation tool which provides a lightweight and elegant way for testing web apps.

Selenium WebDriver is now available as an SDK extra in the Android SDK, and supports 2.3 (Gingerbread) and onwards! Whether or not your site is optimized for mobile browsers, you can be sure that users will be accessing it from their phones and tablets. WebDriver makes it easy to write automated tests that ensure your site works correctly when viewed from the Android browser. We’ll walk you through some basics about WebDriver and look at it in action. WebDriver Basics WebDriver tests are end-to-end tests that exercise the web application just like a real user would. WebDriver is an Android SDK extra and can be installed following these instructions. Getting Started First, create an Android project containing an empty activity with no layout.

Now let’s see our test in action! Interaction Testing.