Android Development 10

Android Development Tutorial 10Welcome to part 10 of my Android Development Tutorial! In the next few videos I will show you how to create an Address Book / Contact App using both Android and SQLite.

I was asked by a bunch of you guys slow down for a few tutorials so that it would be easier to completely understand what is going on. So, I’ll go through how to define constants for my interface in the string.xml and dimens.xml files. I’ll then create the activity_main.xml file which will be the opening interface. I’ll also introduce the ListView.

If you like videos like this, it helps to tell Google+ with a click here [googleplusone]

Code From the Video


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

    <string name="app_name">Contact List</string>
    <string name="action_settings">Settings</string>
    <string name="add_contact">Add Contact</string>
    <string name="first_name">First Name</string>
    <string name="last_name">Last Name</string>
    <string name="phone_number">Phone Number</string>
    <string name="email_address">Email Address</string>
    <string name="home_address">Address</string>
    <string name="contacts_title">Contacts</string>
    <string name="add_button">ADD</string>
    <string name="save_data">Save</string>
    <string name="edit_contact_title">Edit Contact</string>
    <string name="edit_button">Edit</string>
    <string name="delete_button">Delete</string>




    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="padding_5dp">5dp</dimen>




<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android=""
    android:orientation="vertical" >
        android:visibility="gone" />
           android:textStyle="bold" />



<TableLayout xmlns:android=""
    tools:context=".MainActivity" >
	    android:background="#000000" >


            android:textSize="20sp" />

	    android:layout_height="wrap_content" >



26 Responses to “Android Development 10”

  1. ahmed tarek says:

    thank you for these video i want to learn java EE can you see me some reference

    • Derek Banas says:

      You’re very welcome 🙂 I’ll cover JEE as soon as possible. Sorry it is taking so long, but I want to finish my Android tutorial first. I may cover a few things though soon like REST services

  2. John Shaw says:

    Hi Derek. I’ve been following your Android Development series religiously, and actually just got done wrapping up tutorial #14.

    I ran into issues using the Contact List app I built following your tutorial, and noticed a difference in your code on this page and the code in the video @ 12:12, specifically with defining the ID of a element. Your code in the page says this: android:id=”@android:id/list”, where the video has the android:id being defined similar to the TableRows.

    This caused a java.lang.RuntimeException error, and I had to turn to Google to find an answer, simply because I didn’t realize there was, in fact, a difference in defining the ID of a ListView versus any other UI element.

    The answer I found on StackOverflow didn’t explain WHY the needed @android:id/list style, as opposed to what a TableRow element would need, so I’m wondering – do you know why a ListView needs that special ID attribute format?

    Thank you for all of your amazing tutorials, they’ve been a big help for me in learning Java and Android development. Can’t wait for more!!

    • Derek Banas says:

      You’re very welcome 🙂 I have many more Android tutorials coming. The reason why I have defined it that way is because as you’ll see in part 13 MainActivity extends ListActivity. That is the only reason. Continue with the tutorial and it should make sense. If not ask me and I’ll go further into it.

  3. Daniel says:

    Hi Derek,

    Thank you for your dedication and willingness to share your knowledge with us. =)

    I’ve been having a problem with the Graphical Layout tool. The button that makes the Preference Chooser pop up is not working. I click it and nothing happens.
    If I click in the space to the right of some of the properties a sidebar appears with a list for me to choose from.

    For this tutorial when I click on the Margin-Left property nothing happens.

    I’m using a Mac 10.8.5 and the Eclipse Indigo. Would you have any insights?

    Once again thank you for your tutorials!

    • Derek Banas says:

      Hi Daniel,

      You’re very welcome 🙂 I’m happy that I have helped. Almost every time you get strange errors like that a Help -> Check for Updates will solve the problem. For some reason Eclipse will at times update on tool and not the others?

      I hope that helps

      • Thomas Molloy says:

        Hi Derek,

        First thing I wanna say is thanks for the great tutorials. You make it almost fun to study up on the technical stuff!

        I think that I have a solution to Daniel’s problem and it kinda involves an eclipse update. There is a bug in the eclipse graphical layout for API 19 that makes it impossible to choose a resource. To get around this of course you can code in the resource yourself but also you can use API 18 or some other version number when in graphical layout. At the top right of the screen just below the file tabs there is a little green android robot with the number 19 beside it. Click this and choose API 18. If there is no option you need to open up the API manager and install it from there. I hope this is of use to you.


  4. Benny says:

    Thanks Derek for your tutorials i love them and learn a lot from you.

    regarding layout weight i have read that when using layout weight is is recommended to use layout_width=”0dp”

  5. Reva says:

    Hi Derek, I have a question about the SQLite. How do I retrieve the value from the spinner and context menu and save it in my SQLite?? Is it the same as editText or must i need to add some codes?

  6. ChrisM says:

    Derek, can I ask why you mix the use of the fill_parent and match_parent values within your layouts? When looking at the source, the two values are defined as the same constant value, and docs state that fill_parent was deprecated in Froyo. Do you find that some instances the classes respond differently to the two constants, or is it simply a preference to use the fill_parent value?

    • Derek Banas says:

      Use match_parent. I only used fill_parent because I have been making Android apps for a long time and I was just used to using fill_parent. Sorry about the confusion.

  7. Charley says:

    Q – can u post the codes you display without line numbers, so it’ll make it easier to copy and paste the code?

    AWESOME Videos! thanks soo much.

  8. Devin says:


    Have you created a tutorial for creating a ListView with custom section titles and sub labels for each row?

  9. Peter says:

    Hi Derek!

    Your tutorial are just on point. Thx so much for helping out people. I am done with the address book project which i followed step by step so I can understand but I realized you did not talk about the manifest file. Is it not necessary to put in the various activities in the manifest file?
    I ask this because when I save the contact details, it takes me back to the main activity but it does not show the list of saved contacts. Kind instruct on this.

  10. jmac says:

    Is the button an exception to the layout_width and layout_height requirement needed for views??

Leave a Reply

Your email address will not be published.