New tutorials

Welcome to our Tutorials section! We are working hard to bring you high quality and interesting tutorials. Also check out the tutorials forum if you have any problems or want to make a request. Also, if the text in the code samples is too small, click here for an explanation.

  • How to update custom listview images simply

    So in this tutorial I'm going to show you how to refresh imageviews' contents periodically (let say by Handlers if you download the picture from web).
    I had painful 2 days figuring out what's a good solution here, I tried to give IDs to imageviews and that sort of sick things, but believe me, it wasn't worth it. The solution is so simply that I hardly can believe.
    What we're lookign for here is instead of create new Adapters and HashMaps (which...
  • How to set an image as wallpaper on different api levels

    Pretty easy! :)
    Use the context’s setWallpaper method.

    1. getApplicationContext().setWallpaper(bitmap)

    Don’t forget to add the SET_WALLPAPER permission to your AndroidManifest.xml!...

  • Leaving an Android application

    One of the strange things with android is that there is no "the user has closed the application" event. Applications activities often just go to the background, and the android system may kill them whenever it wants, even when another activity of the application is still running in the foreground.

    You can not be sure that activities you started and sent...

  • Xml remote procedure calls on android

    Using web services on android phones, is pretty simple. For most popular services, there is a usable library available.
    Here is a little snippet for using an android library, called android-xmlrpc.

  • How to make a phone call from your application

    To enable your application to initiate a phone call, you must set permissions in the manifest file:

    1. <?xml version="1.0" encoding="utf-8"?>
    2. ...

  • Android unit testing

    For unit testing you can use the built in JUnit framework just like in "standard" java applications.

    A unit test is to test some low-level part - usually a single class - of a project, working individually.

    The only trick is to extend AndroidTestCase in your test case instead of TestCase some Android specific methods, like getContext() which is often required by android functions.

    Lets see a very simple example using eclipse:

    - Create a new project to test, create...

  • How to customize Toasts

    Customizing Toasts

    A toast notification is a message that pops up on the surface of the window. It only fills the amount of space required for the message and the user's current activity remains visible and interactive. The notification automatically fades in and out, and does not accept interaction events.

    The Basics

    You can create customized Toasts and setting its display position, as you like.
    Here's a little code snippet to demonstrate how it...

  • Date handling in Android development

    This unusual topic came around quite a few times in the last couple of days, first with our own rss parser, and today with android-xmlrpc.
    In our rss parser, we wanted to have as much flexibility as possible, so we could use many types of localized rss pages, that have different date formats.

  • WebView with zoom controls, image from SDCARD

    The Problem:
    When I'm trying to load an image (tried both gif and png) from my assets directory, into a webview.
    In my assets folder, I have an image called myImage.gif
    Here's my wrong code:

    1. WebView data = (WebView) findViewById(...

  • Calling system settings from an Android app - GPS example

    This tutorial shows how to redirect the user to a system settings screen asking to modify some settings the application depends on. We will make a specific example with GPS: The application can be used only if GPS is available.

    The android systems GPS setting screen can be called just like any other Activities: