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 avoid OutOfMemory (OOM) Exception using Bitmaps (Solved)

    Step 1.
    First thing I want you to think about is that do You really need to use Bitmaps?
    If the answer is No, go to step 2. :) Otherwise, think again.
    Ok, Let me explain it. I needed Bitmaps to get the width of the images, to create an ImageAdapter for my Gallery. As far as I know, there's no other way to do that. So I used Bitmaps, and even if I recycled them, once in a while it stopped with the message: DDMS: OutOfMemory .. Phone: Force Close..
    Not to speak...

  • Store images/files in database

    Hoever the practice is to store them normally and save the access route (Uri), sometimes it can be handy to store files/images completely in database.
    In sqlite database there are only a few data types, so its easy to choose: files can be stored in a text as a ByteArray.

    Lets see a sample code, where we download an image from the Internet then store it in the local database:

      ...

  • Using an Android phone's sensors

    Accessing the sensor data of a phone, is not too complicated, but since API level 3, a lot of things got deprecated. Using only the emulator, you have only a few (here is one) options, to simulate sensor data. I would recommend the use of a physical phone. Keep in mind, that not all phones have the same sensors integrated! Cheaper phones might not have a temperature sensor, or a gyroscope, but I'm pretty...

  • How to use canvas in your android apps - Part 2

    In the second part of this tutorial series, I will show you what you can do with canvas and paint.


    If you complete the first part, your onDraw method in Panel class is similar...

  • How to use canvas in your android apps - Part 1

    ...
    If you want to use a custom layout with a canvas in your application, this tutorial may be useful to you. We will draw a kangoo at the end of this tutorial.


    There is a cool article on site Custom View - HorizontalSlider, what you can use to understand the following code:
  • Mastering Android Widget Development - Part5 - Final

    In this last part of the tutorial we will implement buttons to the appWidget, which will directly interact with the appWidget functionality.
    We will have 2 buttons, a plus button to add one more day to the target date, and a minus button to decrease time left by one day.

    First add the buttons to the countdownwidget.xml layout:

    1. ...

  • Hello Baby widget feature update - notification tutorial

    Hello readers, my name is Tamas, and I'm the newest member of the HelloAndroid.com team :)
    Today we decided to update our Hello Baby widget, with a notification feature. So I'm using this opportunity, to show you how to use notifications with widgets.
    The plan was to alert the user with a status bar notification 1,2,3 and 7 days before the...
  • How to make Tabs UI with icons

    So here's how it's going to be look like:

    Your class has to extend TabActivity:

    1. public class YourClass extends TabActivity {
    2. ...
    3. ...

  • Developing a clothing game for Android

    What the hell am I doing? Developing a clothing game for Android...

    Last time I was really bored, i tried to make a simple clothing game for android.

    Here is the tutorial:

  • Mastering Android Widget Development - Part4

    As described in the previous part, we will use a Service to update the appWidget.
    So we will have the Service below, which gets the command (right now we have only the update command), ant the appwidgetId, reads the date from sharedPreferences and updates the widget.

    1. package com.helloandroid.countdownexample...