Archive for the ‘Android’ Category

Importing Google Play Services into IDEA 12

Posted November 28th, 2013 by
Summary

This tutorial will show you how to include Google Play Services into IDEA 12. Step 1 – make sure to get Google Play Services from Android SDK Manager Step 2 – Once this is done, start IDEA 12 and open the project that you want to add Google Play Services to. Step 3 – IDEA […]

Click here to read this tutorial...   |  

Android activity, service, widget lifecycle state management – Tutorial

Posted October 25th, 2010 by
Summary

When creating android applications, that are not trivial, it is important to keep in mind that android activities, widgets, and services have somewhat autonomous lifecycles that are controlled by the operating system itself. This is profound impacts on how you have to think about applications, since there will no longer something unified, but rather are a lot of different parts that are being orchestrated somewhat randomly. For example, applications process can be terminated anytime, or its activities can be terminated, or its services can be restarted. If you do not plan for such diversity in lifecycle states when building each widget service or activity, you will have a really tough time syncing them all up in the final application.

Click here to read this tutorial...   |  

Android Location Providers – gps, network, passive – Tutorial

Posted October 20th, 2010 by
Summary

The best way to handle GPS is to use the “network” or “passive” provider first, and then fallback on “gps”, and depending on the task, switch between providers. This covers all cases, and provides a lowest common denominator service (in the worst case) and great service (in the best case).

Click here to read this tutorial...   |  

Android Event Dispatch Thread or Main Thread – Tutorial

Posted October 12th, 2010 by
Summary

Android applications run in a native Linux process, in the underlying Linux OS. This process houses activities (screens), widgets, and services (non visual long running application parts). When working with Android apps, it is important to remember to keep long running code running in threads that are not tied to the main thread or event dispatch thread, in order to get an “application not responding” error. A common mistake that is made is long running tasks are performed in this EDT/main thread, and this leads to lots of application failures.

Click here to read this tutorial...   |  

Android custom themed Dialog – Tutorial

Posted September 15th, 2010 by
Summary

I was trying to create dialogs and alert dialogs that look the same on all Android smartphones, after he realized the different types of smart phones do something different with the default themes and make buttons, dialogs, etc. look very different from one phone to the other. Everything looks very different in the simulator than it does on a Droid X or Droid 2 for example. Things look more similar on a Samsung Galaxy S, or HTC Incredible, but even there you can see some differences.

Click here to read this tutorial...   |  

Android custom skinned Button – Tutorial

Posted September 2nd, 2010 by
Summary

Some Android phone manufacturers replace the default themes, and styles, and drawable assets with what they think looks good and customized. Unfortunately, the side effect of this customization is that what works great in the emulator, and most phones simply does not work these devices. Eg, Motorola Droid 2 and X have a customized theme that uses really dark backgrounds, and red foreground colors. This can wreck many applications that are designed for a light background with dark text color.

Click here to read this tutorial...   |  

Using JSON for mobile object exchange – Tutorial

Posted March 6th, 2009 by
Summary

I’ve been working with various object encoding schemes to get information transferred over the network between services and mobile apps running on Android and BlackBerry. On Android, I figured I would try using Java object serialization, and that works some of the time, and not for anything complex. I wish the object serialization and deserialization mechanism in GWT would be ported over to all these mobile environments, but I digress. This tutorial outlines the use of JSON for this purpose.

Click here to read this tutorial...   |  

Android Application Provisioning Strategies

Posted August 11th, 2008 by
Summary

There aren’t any good solutions out right now. App provisioning and management are left out of the M5 SDK, and we have to wait until a future release to see this in place. Once it’s in place, these other strategies outlined here may or may not be viable. However, if you can preload an APK file into a device, then the solutions outlined here might work for you.

Click here to read this tutorial...   |  

Android WebView (WebKit) Tutorial

Posted August 11th, 2008 by
Summary

This article shows you the limitations and capabilities of the WebView component. You will see how to download files from the network and use them in HTML, as well as assets loaded in the APK file.

Click here to read this tutorial...   |  

Android Service creation and consumption Tutorial

Posted August 7th, 2008 by
Summary

This tutorial will show you how to create a simple service, that does not use IPC (inter process communication). Services are great for running long running tasks and business logic, outside an Activity, which is tied to the user interface. For example, if you have a background task that has to download data periodically, then you should put that task in a Service. You can explicitly start a service and stop it as well. With IPC you can connect to a running service and call methods on it, however, in this example, I won’t be using any IPC; instead all data transfer will happen via a shared object and a listener.

Click here to read this tutorial...   |  

Android Animation Framework Tutorial

Posted August 5th, 2008 by
Summary

This tutorial is an introduction to the built in animation frameworks that are part of the Android UI library. Without writing any animation/drawing code, you can do 2 types of animations – layout transitions that affect ViewGroups, and sequences inside a View. You can also do frame by frame animation, but this tutorial will not cover that. The basics covered here affect layout transitions, and animation of a View itself, using tweening animation, which includes each of the following effects (or any combination) – Alpha, Rotate, Scale, and Translate.

Click here to read this tutorial...   |  

Android ListView and custom adapter Tutorial

Posted August 4th, 2008 by
Summary

This tutorial will show you how to use ListView to display selectable lists of non trivial data, using complex cell renderers. The ListView is a selectable list. You can attach a variety of data models to it and load different display layouts (cell renderers). You can create your own model and cell renderer. This model-view combo is called an Adapter. In this tutorial, I will show you how to extend create your own Adapter from scratch, and create your own cell renderers from scratch as well.

Click here to read this tutorial...   |  

Android LinearLayout Tutorial

Posted August 4th, 2008 by
Summary

This tutorial shows you how to use the LinearLayout container (using Java code, not XML markup), which is the simplest layout mechanism available on Android. If you’re familiar with Swing’s BoxLayout then you will have a good idea of what this container has to offer. Linear layouts are really simple… you can add components horizontally or vertically to a ‘bag’ or ‘box’.

Click here to read this tutorial...   |  

Android UI Themes Tutorial

Posted July 31st, 2008 by
Summary

This tutorial will show you how to use Android’s theme-ing capabilities. You can set background color, image, etc. on widgets, dialogs, and activities.

Click here to read this tutorial...   |  

Android TableLayout Tutorial

Posted July 29th, 2008 by
Summary

This tutorial will show you how to use the TableLayout container, which is like an HTML table. The UI layout code is done in Java, not XML. A class (LayoutUtils) is provided to make it easier to attach layout params to View objects.

Click here to read this tutorial...   |  

Android Option and Context menu Tutorial

Posted July 16th, 2008 by
Summary

This tutorial will show you how to create options menu (hooks into the MENU button) and context menu (press and hold a component).

Click here to read this tutorial...   |  

Android XML View inflation Tutorial

Posted July 16th, 2008 by
Summary

This tutorial will show you how to instantiate or inflate a View from XML; this is useful for components that don’t provide a Java API to tweak with certain style attributes. The Button class is used as an example; you can only get certain styles to show up via XML that aren’t available via the Java API.

Click here to read this tutorial...   |  

Android Activity and sub-Activity Tutorial

Posted July 15th, 2008 by
Summary

This tutorial will show you how to create a sub-Activity from a calling-Activity, and process the results produced by the sub-Activity, if you want to do so. Also, the various ways of launching a sub-Activity are covered, along with the Android Activity history stack. A subclass of Activity is also provided that makes it trivial to launch sub-Activities and respond to results from them.

Click here to read this tutorial...   |  

Android SDK and tools – Getting started

Posted July 15th, 2008 by
Summary

This tutorial has helpful pointers for developers who are just getting started with Android. In addition to Google’s documentation on the SDK itself, there are lots of tools that come with the SDK and others that you can download elsewhere that make it a little bit easier to work with Android.

Click here to read this tutorial...   |  

Android – How to build a service-enabled Android app – Part 3/3 Multithreading

Posted June 4th, 2008 by
Summary

I’ve written 3 tutorials to show you how to create a service enabled Android application that performs all of it’s network I/O in a background thread (not the UI thread). These tutorials are split into three parts. This tutorial shows you how to use background threads to perform long running network IO operations, so that the main UI thread is not locked up.

Click here to read this tutorial...   |  

Android – How to build a service-enabled Android App – Part 2/3 Networking

Posted June 4th, 2008 by
Summary

I’ve written 3 tutorials to show you how to create a service enabled Android application that performs all of it’s network I/O in a background thread (not the UI thread). These tutorials are split into three parts. This one shows you how to use Apache HTTP Client to connect to services over HTTP or HTTPS and exchange serialized Java objects with services.

Click here to read this tutorial...   |  

Android – How to build a service-enabled Android app – Part 1/3 UI

Posted June 4th, 2008 by
Summary

I’ve written 3 tutorials to show you how to create a service enabled Android application that performs all of it’s network I/O in a background thread (not the UI thread). This tutorial shows you how to build a simple UI without using XML, by writing Java code to layout the UI.

Click here to read this tutorial...   |