Category: Beginner

  • [TUT] Android Gradle App with Robolectric JUnit tests

    This tutorial will show you the skeleton of an Android application that uses the Gradle build system and runs Robolectric JUnit tests on Android classes. This follows on from my tutorial about JVM JUnit tests, you can have one type of testing without the other. For instance you could bundle all your JVM tests inside…

  • [TUT] Android Gradle App with JVM JUnit tests

    This tutorial will show you the skeleton of an Android application that uses the Gradle build system and runs JUnit tests on java classes. If your here and reading this, I assume you already know Android code runs on Dalvik and the SDK’s used when developing on a computer are stubs. (Hence the Stub! exception…

  • [TUT] Setting up Android Studio & Gradle [windows 7]

    This is a simple walk through of setting up the new Android Studio IDE and Gradle. Gradle is the new build system for all Android projects. Prerequisites: you have a JDK installed. JAVA_HOME is set. (you can test this by typing java -version in a console) warning: This post is very image heavy, so get…

  • [TUT] Email Feedback from Users (device information)

    I recently updated my McDonalds Calories application and improved the feedback facilities. Whilst I was doing this I realised it would be good to do in all of my apps and therefore wrote this utility class just for the purpose. The idea is to gain more information about the users devices when they send you…

  • Register for YouTube API use

    This post walks you through registering for the YouTube API. This is necessary if you want to upload / download videos from YouTube using OAuth. Another way to think of registering is that, it creates a server side representation of your android app that you are going to create, so that Google can recognise your…

  • [TUT] Keep Screen on/awake – 3 possible ways

    This tutorial will show you how to stop the screen timing out for an android activity so you can continue to show some information without user interaction and without the screen going off. Dont use a WakeLock when you don’t have to, unless you specifically need to force the device away (processor and all). A…

  • [TUT] Running an Ant script with Eclipse

    In a previous tutorial I explained how to use an Ant script to build and run your projects. However it’s no good knowing how to do that, if you can’t run the Ant script. So here is a simple picture by picture example of running an Ant script with Eclipse. First you need to add…

  • [TUT] Add Your App to the Android ‘do something’ Menu (using Intent Filters)

    This request is to be able to add your application to the context menus of the android system. When the android system or another application wants to do a specific task, it will broadcast an intent saying “can anyone do this for me“. Here I’ll show you how you can grab this request so your…

  • [TUT] Basic Date Picker

    I was just looking on the Android Developer site and the only tutorial they had to show a DatePicker was within a dialog. I didn’t want my datepicker in a dialog, I wanted it embedded into my activity. However I already knew there was a DatePicker XML view that I could use, so I was…

  • [TUT] Sliding Drawer Activity – Animate an Activity

    This tutorial is to show you how you can have a new activity animated to slide into view just like the Android Sliding Drawer. The tutorial show’s the animation coming in from the left and leaving from the left, but you can easily change this to animate from the left, right, up, down, you can…

  • [TUT] Array List of countries for arrays.xml

    Just created these two matching pair array’s of countries and county codes thought I would share them with everyone since I couldn’t find them myself. Could use the full names for a spinner selection and the short hand for database storage / look up / sending to a server. Or anything else! The Countries list,…

  • [TUT] Button to open web browser

    Someone requested this so here goes: If you want to send someone to a website when they press a button in your activity: MainActivity class: [java] package com.blundell.twitterlink; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Main extends Activity { /** Called when the activity is first created. */…

  • [TUT] ListView with a Footer Item

    Just figured this one out myself. If you want a ListView with a button / edittext or other view item below the ListView that stays at the bottom of the screen while the view still scroll’s:   <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”https://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:padding=”10dip” > <LinearLayout android:id=”@+id/bottom_view” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_alignParentBottom=”true”> <!–Put whatever view…