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 use static variables in activities

    As previously described in Leaving an Android application, when you exit an app by pressing back button its resources are not completely destroyed immediately.

    I would like to explain a concrete mistake I met multiple times, in connection with this behavior, which is easy to commit, if you forget this.

  • Root your phone without using an usb cable

    A few weeks ago ztomi had a tutorial about ADB wireless. You propably already have your favourite way of rooting your phone (superoneclick etc), but what if you don't want or can't use the usb port of your phone?

  • Interrupting/cancelling threads

    threadWhen you run a background operation using a Thread, or AsyncTask in most of the times it is needed to be able to interrupt it.
    In lot of cases, when the user starts a sceen in our application, a thread is started in the background, to load its content. Hoever if the user leaves the screen before its loading is complete, the loading process should be interrupted. Even if the loading prosess can not be...

  • Remove autofocus from an EditText in Android

    When we create a layout with an EditText or an AutoCompleteTextView, for some reason, it always gains the focus on starting.

  • How to create context menu

    There are two main methods that you must implement to get this thing work.
    First of all, implement and override the onCreateContextMenu():

    1. @Override
    2.         public void onCreateContextMenu(ContextMenu menu,...

  • SQLite subqueries

    Recently we worked with big databases under android, and during that I met query optimization problems when using subqueries.

    From my previous experiences with MySQL I thought, the database engine optimization is always the best, and there is no way, that multiple queries from program code is better, but I ended running multiple selects in a loop in this case for...

  • How to create android applications for tablets?

    With the new 2.3 SDK, we get the opportunity to develop android for tablets. (At least, with the Galaxy Tab Addon).

    When starting a new tablet emulator, first we need to set the "Scale display to real size" option. This helps to set the tablet's size, to our screen size. In my case, it's 1440x900px.

  • Advanced 9Patch drawing in android

    Drawing 9patch can turn into a nightmare easily. I would like to present the other side. The most common problem, to create draws wich are look well in portrait mode and landscape mode too.

    Here are some 9patch technics:

    (Note: This article don’t tell the basics of 9patching. If you are new in this technics, examine this page first:...

  • Handling old data in new app versions

    When you release a newer version of your application, on update the android system identifies from the package name and version number, that the user has an older version installed. During updating not all data of the previous version is overwritten, databases, preferences, previously downloaded/created files on sdcard or internal storage remain unchanged. If there are any incompatibility with the old version of these, is must be taken care of.

    First of all, files on the external...

  • Android 2.3 Gingerbread SDK review and bugs

    gingerbreadIt's been over a week since gingerbread came out, i've been using the updated sdk since day one.

    Here is a little review about it from the developers point of view (it's not as sweet as the name suggests...).