Free Android app covering all aspects of addiction, including prevention and treatment

Articles

All published blog articles go here

Cut the connection and debug your app on the move

Android debug using sharedPreference app testing icon

Here’s how you can debug your app without connecting your device to your development pc or laptop.

We’ll show you how to record crucial events that you want to monitor in a preference file for later examination.

Sunday, 02 April 2017 18:13

Your Android app’s versionName, versionCode and ApplicationID made easy

Android applicationId, versionCode and versionName icon

 

So what’s an Application ID?

Each app has a unique id which looks something like this com.example.myApp. No two apps can have the same id.

Sunday, 01 January 2017 16:18

Using Realm databases in Android apps: A beginner’s tutorial

Android realm database tutorial icon

What is Realm?

Think of a Realm as a database.

A Realm is similar to a database and can contain different kinds of objects. You can use a Realm in your app instead of an SQL database.

The Realm is saved in a file on your device and can be backed up.

You can also create a Realm in memory which is destroyed when you close the realm.

Realm works seamlessly with Android and is very easy to set up and use.

Wednesday, 12 October 2016 10:07

Using a Firebase Realtime Database in your app

firebase tutorial icon

Firebase is a Google product.

Use the start-up package for free and only start paying once you’ve expanded beyond the free package limits. You can check out the pricing here https://firebase.google.com/pricing/

Here’s a quick summary of our tutorial app

Sunday, 12 June 2016 18:03

Open Images Gold

Open Images Gold free Android app icon

Version 5

Get the Free Android app, Open Images Gold.

  • Download free high quality images
  • Use them anywhere for free
  • Save them on your device for free
  • Save them in Dropbox for free
  • Save them in Google Drive for free
  • Share them with friends for free

Android app Open Images Gold at Google Play store

Saturday, 21 May 2016 19:58

The latest Free Clip Art Gold: Version 2

freeClipArtGold free clip art gold android app icon

What’s Clip Art?

Clip art is simple pictures and symbols that you can use in your documents, email, etc.

Wednesday, 20 April 2016 10:57

Professionally edit your images for free!

smart photo editor app icon

Edit all your images.

Take a photo then edit it immediately!

Use the inbuilt file picker to find any image on your device or in your Google Drive.

  • Select the image
  • Load the image into the editor
  • Edit the image
  • Share the image

It’s that simple!

Be smart. Get the Free, Smart Photo Editor for perfect pictures!

Bring your images and imagination. You’ve got the tools.

google play

Sunday, 13 March 2016 12:04

Help for users of the Smart Photo Editor Android app

Have you installed Smart Photo Editor?

Why not get in now!

google play

Floating Action Buttons

The Floating Action Buttons appear at the bottom of the screen.

The Share button only appears after a successful edit.

Smart Photo Edito fabs labels

Tap on one of the Floating Action buttons to perform the relevant action

Sharing images

Select the Share Floating Action Button if you want to share the edited image.

You can use any of the apps displayed in the chooser to share the edited image. For example:

  • Email the image as an attachment
  • Save in your Dropbox
  • Save in your Google Drive

Only apps installed on your device and that are capable of sharing the image will be displayed in the chooser pop-up.

Tapping the Share Floating Action Button causes an app chooser to pop up.

Thursday, 10 March 2016 17:26

Android Navigation Drawers: Quick and dirty clean!

android material design navigation drawer tutorial icon

Do you know where you are: So what’s a Navigation Drawer?

The navigation drawer is a panel that slides out from the left (or right) side of the screen.

The user opens and closes the drawer by swiping their finger from or to the screen edge. The drawer contains a menu of navigation options.

Users can also open the drawer by touching the hamburger icon (if it’s displayed) in the left corner of the Toolbar.

android material design navigation drawer hamburger icon

The Hamburger icon on the left of the Toolbar

android material design navigation drawer screenshot

The navigation drawer panel displays a menu of items that the user can select from

Did you know that you can slide the navigation drawer out from both the left and the right side of the screen? Read on to see how.

Wednesday, 09 March 2016 10:19

Backup your data anytime, anywhere using SyncBackPro

SyncBackPro backup software icon

SyncBackPro, the professional's tool to backup, synchronize, and restore data files.

Saturday, 20 February 2016 14:42

Choosing multiple items in a RecyclerView list: part 2

RecyclerView choice mode multiple selections tutorial

We’re going to show you how to select multiple items in a RecyclerView list and then save all the selected items’ details at the press of a button.

You’ll easily be able to customise the code to suite your needs.

Have you seen part 1 where we lay the foundation?

Tuesday, 09 February 2016 10:35

Choosing multiple items in a RecyclerView list: part 1

Android RecyclerView choice mode tutorial icon

We’re going to show you how to select multiple items in a RecyclerView list and then save all the selected items’ details at the press of a button.

You’ll easily be able to customise the code to suite your needs.

Monday, 08 February 2016 16:25

Open Images Gold, your free Android app that gets the image for you!

openImagesGold icon

Need high-quality photos, illustrations or vector graphics? Want to get them for free and use them anywhere, anytime for free?

Open Images Gold, a free Android app lets you search Pixabay.com’s database of over 400 000 high-quality images.

Select your favourites to view later or share an image with friends using your favourite app.

You can also save the images in your Dropbox or Google Drive.

Get it now!               google play button small  

Saturday, 30 January 2016 14:39

Free Clip Art, Gold edition

free clip art gold icon

Free Clip Art, Gold edition is a free Android app available in the Google Play store.

Get the New Free Clip Art, Gold edition Now, it's FREE!  google play button

Friday, 15 January 2016 11:33

Free Clip Art Help

This is the online help screen for the just released update to the Free Clip Art app NEW Free Clip Art, Gold edition app.

The update NEW Free Clip Art, Gold edition app uses Android’s Material Design visual language, making the app super easy to use.

Get the New Free Clip Art, Gold edition Now!  google play button

Tuesday, 05 January 2016 09:53

Two for FREE! A free Android app for Free Clip Art images

featured graphic2 

You need an image, NOW! You want it for FREE and you want to be able to use it without being sued!

No problem. We’ve got an app just for you.

Sunday, 31 May 2015 11:22

Google Drive, file picking!

Google Drive file picker tutorial icon

Let us show you how easy it is to use Google Drive from within your apps.

In this tutorial we show you how to display a file picker showing the folders and files in the user’s Google Drive. The user can then select a folder or a file and some of its metadata is then displayed in the LogCat. (Have you seen our LogCat tutorial? Using Android’s Log class API to debug Android application code).

Sunday, 22 March 2015 11:24

Using Google Drive in your apps

Google Play Services Drive tutorial icon

Google Drive is your storage in the sky.

You can use it like a local drive and access it from anywhere from any device.

Our tutorial shows you how to upload a text file from within your app to the user’s Google Drive. We also show you how to download the contents of the uploaded file.

Sunday, 15 March 2015 00:00

App remodelling: From Activities to fragments

Converting Android activities to fragments activityToFragment icon

Got an app using activities that you want to convert to using fragments?

We’ll show you how easy it is to convert activity apps to fragment apps. It’s no big deal.

Wednesday, 25 February 2015 00:00

Launch Mode

Android launchMode launchMode icon

The launch mode specifies how a new activity should be associated with the current task.

Before trying to make sense of this, let’s first have a look at:

  • the Back Stack
  • and Tasks
Sunday, 08 February 2015 00:00

Get in touch and stay in focus

Android Touch Mode and focus icon

So what’s Touch Mode?

Users can interact with their Smart Android devices using hardware keypads and buttons or by touching the screen.

Touching the screen puts the device into touch mode. The user can then interact with it by touching the on-screen virtual buttons, images, etc.

The device remains in touch mode across activities until the user exits touch mode.

Touching a hardware button causes the device to exit touch mode.

You can check if the device is in touch mode by calling the View class’s isInTouchMode()  method.

So what’s focus?

A view or widget is usually highlighted or displays a flashing cursor when it’s in focus. This indicates that it’s ready to accept input from the user.

Focus is necessary for devices using trackballs, styluses, external keyboards and hardware buttons so that the user can see which view is ready to receive input.

Focus is not necessary when the device is in touch mode.

Sunday, 25 January 2015 00:00

What a partnership! Picasso and RecyclerView

Android RecyclerView and Picasso tutorial icon

If you display images in lists or grids then you should consider using Picasso and RecyclerView.

Picasso is a powerful image downloading and caching library package which you include in your app build. It simplifies working with images, reducing the code that you need to use to one line of code.

Picasso is fast and easy to use and it’s FREE!

The RecyclerView widget is essentially a container that you can use to display large sets of data. It’s very efficient as it only displays a few items at a time. Views that are no longer needed are recycled and reused.

Not having to keep on inflating views saves CPU resources and valuable memory is saved by not having to keep views alive in the background.

Combine Picasso and RecyclerView and your app will move at the speed of light!

Sunday, 11 January 2015 00:00

Using the OkHttp library for easy downloading

Android cloud connection OkHttp http icon

Want to simplify communicating with the cloud?

More and more mobile apps are making use of data storage in the cloud. Android provides the tools to communicate with the cloud but it takes quite a bit of coding to make it work.

OkHttp is a popular library that reduces the amount of code, making it very easy for you to make use of cloud storage for your app.

OkHttp is developed by Square and is FREE!

Sunday, 04 January 2015 00:00

Using custom fonts

Android custom fonts icon

The Android SDK comes with a set of fonts but you can also use your own fonts.

We’ll show you how.

Sunday, 28 December 2014 00:00

Passing Parcels between activities

Android Parcelable interface tutorial icon

You can pass primitive data, like integers, strings, booleans and array lists between activities.

You can also pass Serialized object between activities. We showed you how in a previous tutorial. In this tutorial, we show you how to use the Parcelable interface to pass objects between activities.

Saturday, 20 December 2014 00:00

KoboSale

Click on image to go to book store

 

Tuesday, 16 December 2014 00:00

Passing Serialized objects between activities

Android Serializable objects icon

You can pass primitive data, like integers, strings, booleans and array lists between activities.

You can also pass Serialized objects between activities. We’ll show you how.

Sunday, 14 December 2014 00:00

RecyclerView and CardView widgets for all

RecyclerView and CardView tutorial icon

Android’s latest release, Lollipop (Android 5.0 API Level 21) includes the new RecyclerView and CardView widgets. They’re also made available for use on devices running API Level 7 and above through the Support Libraries.

The RecyclerView provides a more advanced and flexible way of displaying lists than the old ListView.

The CardView widget enables you to display views inside a card. You can design the card so that its look is consistent across your app.

Wednesday, 26 November 2014 00:00

Toolbars

Android toolbar icon

A Toolbar is similar to an ActionBar.

It’s a ViewGroup so you can place it anywhere in your layout. You can even replace the ActionBar with a Toolbar.

Toolbar’s are also more flexible. You can modify its size, colour, position, etc. You can also add logos, labels, navigation icons and other views to it.

With the release of Android 5.0 and material design, Android has updated the AppCompat support libraries so that we can use Toolbars on devices running API Level 7 and up.

Sunday, 16 November 2014 00:00

Double up: using expandable lists

Android ExpandableListView expandableList icon

Expandable lists let you create lists within lists.

They’re ideal for list items that have sub-categories. The user selects an item from a scrollable list and another list pops open. They can then make another selection from this list.

Sunday, 09 November 2014 00:00

Creating menus in code

Android add menu programmatically icon

It’s best to define your menus in XML in a menu resource file. However, sometimes you may want to create or modify a menu programmatically.

We’ll show you how to create and modify your menus in code.

We’re using the support library so that our code will work on devices running Android 2.1.x (API Level 7) and higher.

Sunday, 02 November 2014 00:00

Context

Android context icon

The Context class gives you access to the global information about an application’s environment. It lets you:

  • Access the apps resources and classes
  • Communicate with other app components
Monday, 27 October 2014 00:00

All spaced out!

Android gravity, layout_gravity, padding and margins icon

Don’t be confused by:

  • The gravity and layout_gravity attributes
  • padding and margins

Check out these quick examples…

Sunday, 19 October 2014 00:00

How to keep your clothes on and have fun with text!

Android TextView icon

You use the TextView class to display text to the user.

Although you can also edit the text displayed in text views, it’s best to use the TextView subclass, EditText to do that.

The TextView class has a number of attributes that you can use to make your text really stand out. We’ll show you a few to whet your appetite.

Read on to see how to:

  • Create and position a TextView in a RelativeLayout in code
  • Add shadows to your text
  • Rotate your text
  • How to use different font families to impress with your text
Sunday, 12 October 2014 00:00

Throw your weight around

Android layout_weight attribute weight icon

Linear layouts support a layout_weight attribute.

We can use the weight attribute to allocate a portion of the layout’s space to a view, depending on its weight.

All views have a default weight of 0.

You can set a weight attribute using a float value for any view that you use in a LinearLayout. Android will then divide the available space up amongst the views proportionately, depending on their weight values.

Sunday, 05 October 2014 00:00

Softly, softly. Using Android’s soft keyboard: A tutorial

Android soft keyboard tutorial icon

In the introduction, we covered the basics of using soft keyboards.  If you haven’t read it yet, you’ll find it here: Android’s soft keyboard. An introduction.

In this tutorial, we’ll show you how to use the soft keyboard in your apps.

Tuesday, 30 September 2014 00:00

Softly, softly. Using Android’s soft keyboard: An introduction

Android soft keyboard introduction icon

Need to capture text input in your app?

Android supports an on-screen soft keyboard as well as attached hardware keyboards.

The soft keyboard appears when a text field is in focus and disappears when it’s out of focus. The keyboard positions itself at the bottom of the screen over the app window. It has its own editing area.

In this introduction, we’ll cover the basics of using soft keyboards. Later, in a follow up tutorial, we’ll show you how to use the soft keyboard in your apps.

Monday, 29 September 2014 00:00

Keeping it local

Android localisation icon

Android apps can be installed on devices around the world. If you want to distribute your app to this large market, then you should provide alternative resources such as text, sound and images.

Android makes it easy to include alternative strings, sound files, layouts and images so that your app will work in any country and in any language.

Our tutorial app will show you how to include alternative text and image resources.

Sunday, 14 September 2014 00:00

Using a SeekBar to change the size of text in a TextView

Android SeekBar icon

Seek Bars are like Progress Bars, with a slight difference. The user determines the progress by moving a slider.

We’ll show you how to use a SeekBar to change the size of text in a TextView.

Monday, 08 September 2014 00:00

Pick your date

Android DatePicker icon

Date Pickers let you pick a date that is correctly formatted and adjusted to the user’s locale.

It’s best to show your DatePicker in a Dialog Fragment which has been around since API Level 11.

We’ll show you how to use a DatePicker in a Dialog Fragment on device’s running API Level 4 and above.

We use the support library’s DialogFragment. You can use the platform version of DialogFragment if you’re developing for API Level 11 and higher.

Wednesday, 03 September 2014 01:00

Search and you will find

Android search icon

You can use Android’s search framework to search data on a device as well on the internet.

Our tutorial will show you how to use the SearchView Widget and the Search Dialog to do searches.

Sunday, 31 August 2014 01:00

Moving stuff around: Dragging and dropping

Android Drag and Drop icon

Android’s Drag and drop framework enables you to drag and drop data between views.

We’ll show you how to drag an image from one layout and drop it into another.

Tuesday, 26 August 2014 01:00

Just like the movies: Frame Animation

Android Frame Animation icon

View Animations include Tween and Frame animations. Frame animations are also known as Drawable animations.

You define the Frame animation in XML and save it as a drawable. The animation is then displayed as a sequence of images in an image view.

Tuesday, 19 August 2014 01:00

Making a move: Using Property Animation in your apps

Android Property Animation icon

You can use Android’s Property Animation system to animate just about anything, not only visual objects.

Property animations modify the properties of an object over time.

Our tutorial app shows you how to animate View objects to give the impression of movement.

Sunday, 17 August 2014 01:00

Make your apps come alive! Use Animation

Animation animate icon

There are three types of Android animation:

  • Property animations – these enable you to change the properties of an object, like text size for example
  • Frame animations – these display a sequence of drawable images
  • View animations – also known as Tweened animations. These animations are applied to View objects and allow you to:
    • Rotate a view
    • Change the size of a view
    • Change the transparency of a view
    • Move a view

Our tutorial will show you how to use View animations in your apps

Wednesday, 13 August 2014 01:00

Use the Equalizer effect to filter your sounds

Android equalizer effect icon 

Boost and improve your app’s sound quality!

Use the Equalizer effect to get rid of unwanted sounds or to make certain sounds more prominent.

Sunday, 10 August 2014 01:00

Playing sound clips in your apps

Android soundpool icon

The SoundPool class lets you load a number of sound clips into a device’s memory. You can then play these sound clips on demand. You can even play a number of sound clips at the same time.

The clips are decompressed and decoded when they’re loaded so there’s no delay when you play them.

Our tutorial shows you how you can use the SoundPool class to play sound clips in your apps

Tuesday, 05 August 2014 01:00

A recording studio in your pocket!

Android MediaPlayer and MediaRecordewr audio icon

You can use the MediaRecorder class to record audio and video and the MediaPlayer class to playback audio and video.

Our tutorial shows you how to use the MediaRecorder class to record audio and the MediaPlayer class to playback audio.

Friday, 01 August 2014 01:00

Roll your own: Creating your own Custom View

Android customViews icon

Android has a number of views like button, image and text views.

What if there are no views that suite your needs? Well, then you can create your own. We’ll show you how.

Tuesday, 29 July 2014 01:00

Here's how you can create an app widget...part 2

Android's App Widget tutorial part 2 icon

App Widgets are mini apps that give users immediate access to important functions of an app.

We mostly use App Widgets to display important information about an app on a device’s Homescreen.

You can create your own app widgets. Here's part 2 of our tutorial where we show you how to create and use App Widgets in your apps.

Friday, 25 July 2014 01:00

Here's how you can create an app widget...

appWidgets icon

App Widgets are mini apps that give users immediate access to important functions of an app.

We mostly use App Widgets to display important information about an app on a device’s Homescreen.

You can create your own app widgets. We’ll show you how.

Thursday, 24 July 2014 01:00

Keep up with the fashion:  Using Styles and Themes in your apps

styleAndThems icon

Styles specify the look and feel of individual views, like text views and buttons.

Styles help you to:

  • have a consistent look and feel across your app
  • use less code because you define the style once and then use it over and over
  • easily update the look and feel of your app. All the styling code is in one place. Just edit the style and it will change the look and feel of all the views using that style

Themes are simply Styles applied to an app or to individual activities.

Thursday, 17 July 2014 01:00

How to customise your Progress Bars

Android ProgressBar tutorial icon

Progress bars let the user know that the device is busy, for example, downloading a file. It can also show roughly how much longer the download will take.

Progress bars don’t always look the same on all devices.

We’ll show you how to customise your progress bars so that they look the same on all devices

Tuesday, 15 July 2014 01:00

Signs and wonders: Using Gestures

Android gestures icon

Android touchscreen devices can sense when the user touches the screen. They can also record the movement of the user’s finger across the screen. These movements or strokes are also known as gestures.

You can store a collection of gestures in a file and then match the user’s gesture with those in the file.

Our tutorial app lets the user write their name on the screen using their finger. We then compare this gesture to our saved gestures and display the result in a text view.

Monday, 14 July 2014 01:00

In a flat spin: Showing images in a Spinner

Android Spinner spinners icon

Spinners display a list of selectable items.

When first displayed, the Spinner only shows the currently selected item. Touching the Spinner displays the full list of items that the user can choose from.

Our tutorial will show you how to use a Spinner to display a list of images that the user can choose from.

Wednesday, 09 July 2014 01:00

What! No XML? Creating layouts programmatically

Android layout programmatically code layout icon 

Our tutorial app

Our tutorial app creates a table containing text views, text fields and a button.

There is no XML layout file as we do everything programmatically.

A Toast message displays the input after the user has filled in the text fields and pressed the button.

Monday, 07 July 2014 01:00

Using Intents and Intent Filters in your apps: A tutorial

Android Intents and Intent Filters tutorial icon

Our tutorial app shows you how to use intents and intent filters in your apps.

Here’s a quick overview of what we’ll cover. We’ll show you how to:

  • use explicit intents to:
    • start a new activity
    • start an activity to get a result
    • start a service
    • broadcast an intent
    • start a new activity from within a broadcast receiver
  • use implicit intents to:
    • use other app’s components to:
      • send an email
      • pick a contact from the contacts list
      • make a phone call
  • use a pending intent to send a notification
  • use intent filters for:
    • a broadcast receiver
    • an activity
Wednesday, 02 July 2014 01:00

Getting to know Intents and Intent Filters

Android Intents and Intent Filters icon

Intents are messages that you can pass around between your app components. You can also send them to components in other apps. This enables you to create powerful applications where you can use other app’s components to perform tasks for you, such as playing music, sending email, and taking pictures.

Here are some of the things that you can do with intents:

  • Start activities
  • Start Services
  • Deliver broadcasts

The Android System also uses intents to signal changes such as low battery, incoming sms messages and phone calls. You can listen for these intent messages in your apps.  You can also use intents to pass data.

Tuesday, 01 July 2014 01:00

All about repeating, I said repeating, Alarms

Android repeat alarm icon

You can use alarms to trigger events at any time even if your app is not running.

Alarms:

  • Enable you to trigger events at set times and/or intervals
  • Can be used together with receivers to start services and other operations
  • Operate outside of your app so they can trigger events even if your app is not running - even if the device is asleep
  • Help you to minimise your app’s resources. Let the alarm take care of it
Wednesday, 25 June 2014 01:00

Device sleeping on the job? Here’s how you can manage the device awake state

Android wakelocks icon 

You can schedule work to be done. Problem is, nothing will happen if the CPU is sleeping!

The solution is to use a wake lock to prevent the CPU from sleeping while it’s doing your work.

You may also want to keep the screen from turning off. Read on and we’ll show you how…

Tuesday, 24 June 2014 01:00

Save time and the environment (just kidding), re-use your layouts

Android Layouts include and merge layouts icon

Don’t duplicate your layouts, use the <include> tag

Friday, 20 June 2014 01:00

Using Volley to download and display images in a grid

Android Volley GridView Tutorial  grid icon

Here’s the third part of the Volley tutorial.

This is where we show you how to use Volley to download images and display them in a GridView.

Thursday, 19 June 2014 01:00

Using Volley to download and display images in a list

Android Volley tutorial list icon 

Here’s the second part of the Volley tutorial.

This is where we show you how to use Volley to download images and display them in a ListView.

Wednesday, 18 June 2014 01:00

Using Volley to download, cache and display images in lists and grids

Android Volley Library volley icon

Volley is an HTTP Library that makes networking for Android easy. It’s developed by Google and is free to use in your apps.

This is what Volley can do for you:

  • You can automatically schedule network requests
  • You can have multiple concurrent network connections
  • You can  use disk and memory caches
  • You can prioritise your requests
  • You can cancel your requests
  • You can customize Volley according to your needs
  • Your requests are ordered so its easy to populate your UI with data fetched asynchronously from the network
  • Volley supports the download of strings, images and JSON

Volley is not suitable for large downloads or streaming (Volley holds all responses in memory during parsing so large downloads will use a lot of memory).

You should use the DownloadManager for large downloads.

We’re going to be using Volley to download images for display in a list and grid.

Tuesday, 17 June 2014 01:00

Using the Universal Image Loader to populate a GridView

Universal Image Loader Library UIL Grid icon

The Universal Image Loader or UIL is a Library that you can include in your apps to take care of your images.

The Universal Image Loader Library:

  • Asynchronously downloads and loads your images for you
  • Caches the images in memory and on disk for you
  • Displays the images for you
  • Uses multithreading
  • You can configure it to suite your needs
  • You can set options for each image display
  • It's Free and Open Source
Friday, 13 June 2014 01:00

King of the Universe: The Universal Image Loader Library and you

Universal Image Loader Library list icon

So what is the Universal Image Loader Library?

The Universal Image Loader or UIL is a Library that you can include in your apps to take care of your images.

The Universal Image Loader Library:

  • Asynchronously downloads and loads your images for you
  • Caches the images in memory and on disk for you
  • Displays the images for you
  • Uses multithreading
  • You can configure it to suite your needs
  • You can set options for each image display
  • It's Free and Open Source
Wednesday, 11 June 2014 01:00

What are Adapters?

adapters icon

Adapters are the link between a set of data and the AdapterView that displays the data.

AdapterView

AdapterViews are ViewGroups that display child views given to it by an adapter. An example of an AdapterView is a ListView.

Adapters also provide the child views that display the data in the AdapterView. Adapters are responsible for supplying the data and creating the views representing each item.

Sunday, 08 June 2014 01:00

Using the Picasso Library to load images into a GridView

Android GridView icon

A GridView is a ViewGroup. It lets you show stuff in a two-dimensional grid. You can scroll the grid if there are too many items to fit on the screen.

You can control the look of the grid either dynamically or in xml.

You use a ListAdapter to load the data into the grid.

Working with images can use a lot of memory and can cause your app to hang. Our tutorial will show you how easy it is to use the Picasso Library, which is Open Source and FREE, to efficiently load your images into a grid view.

Wednesday, 04 June 2014 01:00

Using Images without killing your app

Android Bitmaps picasso list icon

Images take time to download and display. They can make your app unresponsive, especially when using them in list views, grid views and view pagers.

The solution is to download and process them off the main thread. Then resize and cache them for faster loading.

This takes quite a bit of coding, but there’s a simpler solution!

This tutorial will show you how to use the (FREE) Picasso Library to take care of everything for you. You just add one line of code! It couldn’t be easier!

Tuesday, 03 June 2014 01:00

Loading the Picasso library into your Android Studio project

Picasso is a powerful image downloading and caching library package which you include in your app build. It simplifies working with images, reducing the code that you need to use to one line of code.

Picasso is fast and easy to use.

Picasso takes care of all your image processing for you. It can also download images. 

We're using the Picasso Library in one of our tutorials. If you need help loading the library into your Android Studio project, then here's a quick tutorial for you.

Monday, 02 June 2014 01:00

Using Navigation Drawers in your apps

Drawer Navigation drawer icon

The Navigation Drawer is a panel where you can put your navigation options. The panel is hidden off-screen and displays when the user swipes it onto the screen.

You can also use the app icon as a button to open and close the drawer.

Thursday, 29 May 2014 01:00

Using Swipe Views to swop pages

Android Swipe Views icon

Swipe views allow you to change pages by swiping your finger across the screen.

You create Swipe views by using a page viewer and an adapter. The adapter supplies the pages and the page viewer takes care of moving the pages on and off the screen.

We’re using a ViewPager. It’s a layout manager that takes care of the horizontal scrolling. Usually it’s used with fragments, scrolling them on and off screen.

We’re also going to need a page adapter to supply the pages to the ViewPager.

As we’re using fragments, we have two adapter options:

  • FragmentPagerAdapter – represents each page as a fragment. The fragment is kept in the fragment manager while it’s still possible that it may be used. This adapter is best used for a small number of fragments. It can use lot of memory as fragments are kept in memory while not displayed
  • FragmentStatePagerAdapter – uses fragments to manage the pages. It also saves and restores the fragment’s state. It’s useful for a large number of pages as it uses less memory. Only the state of the fragment is kept in memory and not the whole fragment. It may be a bit slow switching between pages due to it first having to restore their state

We’re going to use the FragmentStatePagerAdapter.

Monday, 26 May 2014 01:00

Using Tab navigation in your apps

Android Tabs navigation icon

Tab buttons are displayed in the Action Bar. You can also use images instead of buttons or even your own custom views.

Tabs are designed to work with fragments. Use them to swop fragments in your activities.

We’ll show you how to use Tabs to swop fragments in your activity.

Sunday, 25 May 2014 01:00

Using fragments to rebuild your activities

Android configuration change and ragments icon

An activity is destroyed and recreated when a device’s configuration changes.

Usually the activity’s lifecycle takes care of saving and restoring its state. Sometimes you may need to restore lots of data. This could take some time resulting in a bad user experience.

Here’s where you can use fragments to retain an instance of your data. You can then get the data out of the fragment and rebuild your activity, super fast!

Be careful not to save objects that are tied to the activity; such as drawables, adapters, views or any other objects associated with a context. They’ll cause memory leaks – the object keeps a reference to the context (the activity for example), so it will remain in memory, leaving less for your app to use.

Have a look how easy it is to use a fragment to save an Object during a configuration change!

Wednesday, 21 May 2014 01:00

Preference Settings

Android Preference Settings icon

Preference Settings allow the user to select basic settings for an app. It’s a way of customising the app to suite the user.

This tutorial will show you how you can create your own custom Preference Settings for your apps.

We’ll be using fragments and Headers so this tutorial is suitable for apps developed for devices running Android 3.0 and up.

There are four parts to the Preference Framework. We’ll cover all of them:

  • Preference Screen Layout –the xml file defining your settings items
  • Preference Activity and Fragment – these host the Preference screens. The activity hosts the fragment and the fragment hosts the Preference Screen, displaying your settings
  • Preference Headers – these are lists of subscreens. An xml file defines the Preference Fragments used for the Headers subscreens
  • Shared Preference Change Listener – listens for any changes in the Shared Preference values

Each Preference appears as an item in a list. The user is able to modify these preference settings.

Monday, 19 May 2014 01:00

Contextual menus, action mode, Contextual Action Bars and other stuff!

Android Contextual Menus icon

So what’s this all about?

Well, it’s sort of about context menus but different.

It’s all about using the contextual action mode. This lets the user do stuff with the items that they have selected.

Enabling the contextual action mode, displays a Contextual Action Bar at the top of the screen. You can then place action items, which are like menu options, on this bar.

The user selects items from a list for example, chooses an action item and the action linked to that action item is performed on all of the selected items.

Here’s an example

Say you had a list of countries and you want the user to be able to select a couple of them to add to a database. This is where you could use the contextual action mode.

It enables the user to select one or more of the countries in the list. They can then select a Save action item, for example, and all the selected country items will be saved in the database.

Thursday, 15 May 2014 01:00

Menus. How to use them in your apps

Android menus

What you’ll learn

We’ll show you how to:

  • Create an options menu
  • Place Action items on the Action Bar
  • Create a Context menu
  • Create a Popup menu
  • Use the support library so that you can display Action Bars and popup menus on earlier versions of Android
Monday, 12 May 2014 01:00

Here’s how to use Broadcast Receivers in your apps: A Tutorial

android broadcast receivers tutorial icon

What you’ll learn

This tutorial will show you how to:

  • Register a Broadcast Receiver in your app’s manifest file. We’ll use this receiver to receive a System broadcast sent when the power cable is plugged into the device
  • Register a Broadcast Receiver in an activity. We’ll use this one to show you how to use permissions to secure your broadcasts and the receiver. This receiver will only receive broadcast intents that have the required permission
  • Use the LocalBroadcastManager to send and receive a local broadcast. A secure way of using broadcasts within your app
Friday, 09 May 2014 01:00

Broadcast Receivers: getting to know them

Android broadcast receivers tutorial icon

You’ve probably used intents to start activities. You can also use intents to broadcast messages.

The broadcast intent carries information about who should receive the message and what should be done with it.

Broadcast Receivers can receive these messages.

This broadcast mechanism runs in the background. The user is not aware of it as Broadcast receivers don’t have a User Interface.

You can also use Broadcast receivers to do small bits of work which must complete within 5 seconds. If they don’t, then an Application Not Responding dialog appears.

Usually you would use a receiver to start other components like Services. You can also send a notification from the receiver.

Monday, 05 May 2014 01:00

Getting active: all about Activities

Android Activity icon

Activities are application components that we, mostly, see as the screen. It displays images, text, buttons, etc. that we interact with. Some activities don’t display anything.

Apps usually have a number of activities. One is seen as the main activity. This is the first screen we see when the app starts.

Thursday, 01 May 2014 01:00

Using your application resources

Application Resources icon

You should keep your resources, like images, strings, values, etc. separate from your code.

Application Resources folders

Some of the folders in the res directory

Wednesday, 30 April 2014 01:00

Bound Services. A way to interact with the Service

andoid bound services tutorial icon

Our tutorial app uses a Service to play a sound clip.

We start a Service when the app starts. The Service will run as long as the app is alive.

We need to bind to the Service to start and stop playing a sound clip. We can leave the clip playing in the Service while it is running. It will continue to play even if the activity is paused or destroyed.

Tuesday, 29 April 2014 01:00

Bound Services: a primer

Android bound services tutorial icon

Quick recap on Services

  • Services are app components that you can use to do work in the background.
  • Services run in your app’s process in the main thread. Don’t block the main thread. Use a separate thread to do any heavy work in your Service.
  • You can also use Services running in another app’s process.
  • Services continue to run until you stop them. The system can also kill them at any time but you can set their priority so that they are unlikely to be killed.

So what happens when we bind to a Service?

Sunday, 27 April 2014 01:00

Out in the open: The foreground Service

Android foreground service tutorial icon

It’s unlikely that the system will kill a foreground Service.

Typically we’d use foreground Services for work that the user is aware of, like playing music.

When we use a foreground Service, we have to send a notification to:

  • let the user know that the Service is running
  • give the user the opportunity to stop it

If you haven’t already done so, you may want to have a look at the article All about Services and Part 1 of the series of Services tutorials, A Simple Service

Wednesday, 23 April 2014 01:00

Doing it in the background. Services Tutorials. Part 1: A Simple Service

Android simple service tutorial icon

Our tutorial app shows you how to use Services to:

  • use a simple Service to update a user’s score on a server
  • use a foreground Service to play music in the background

There are two parts to the tutorial: Part 1 shows you how to use a simple Service and Part 2 shows you how to use a foreground Service.

Tuesday, 22 April 2014 01:00

At your Service: Using Services

android services tutorial  icon

Services are app components that you can use to do work in the background. They don’t have a User Interface.

They are started and stopped by other components (like Activities, Broadcast Receivers and other Services).

You can also share Services with other apps.

Friday, 18 April 2014 01:00

Forget the grass, get off the Main thread!

Android threads tutorial icon

Have you read the article on Processes and Threads yet?

Always remember the two most important rules when working with threads:

  • Don’t block the Main thread
  • Don’t try and access the UI directly from the worker thread

Speed up your apps response times. Move all processing and I/O operations off the main thread. Do the work in a child thread. Our tutorial will show you how.

Wednesday, 16 April 2014 01:00

Android processes and threads tutorial

All Android apps run in their own process and by default, in a single thread.

Processes

It’s about multitasking

Android follows a multitasking design. This allows a number of applications to run at the same time. The problem is that all these apps need memory which is in short supply.

Monday, 14 April 2014 01:00

The parent's in control

fragments tut part3 icon

We only have one activity in our app. It hosts the fragments.

If you haven't already done so, have a look at :

We’re using the support library so make sure that you import the correct class:

Thursday, 10 April 2014 01:00


fragmentsTut part1 icon

Our tutorial app has one activity and two fragments. One fragment contains a list and the other an image.

Running the app on a small device in portrait mode, displays the list fragment. Selecting an item in the list displays the second fragment containing an image.

Flipping the device to landscape displays both fragments side by side.

Running the app on a tablet displays the fragments side by side in both portrait and landscape mode.

Wednesday, 09 April 2014 01:00

fragment tut part2 icon

We'll build the two fragments in this part of the tutorial.

If you haven't already done so, have a look at :

Wednesday, 09 April 2014 01:00

Fragments: What you should know

Seriously, what are fragments?

fragments iconThink of components like buttons and images. You can reuse them over and over in different activities. You can also rearrange them within an activity.

Fragments are similar.

Fragments let you divide your activity into reusable components which have their own User Interface and lifecycle.

Monday, 07 April 2014 01:00

How to save your Activity’s Instance State

What is Instance State?

ConfigChange iconThe data that is saved by the system to restore the previous state of an activity is called the Instance State. This data is saved as a collection of key/value pairs in a Bundle object.

Thursday, 03 April 2014 00:00

Same as it ever was: Persisting the Activity state

ActivityState iconWhen an activity is paused or stopped, its state is kept in memory. When the activity resumes, it is restored from memory.

When the activity is destroyed, it loses all information about its state. When the activity is restarted, it is created from scratch. It is a new activity.

Tuesday, 01 April 2014 00:00

Round and round we go:The Activity Lifecycle

Android activity lifecycle tutorialEach app runs in its own process and contains one or more activities.

The Android run time manages these processes and decides which app to kill if it needs resources.

An app’s priority helps determine if the run time will kill it and its running activities.

The app’s priority is influenced by its highest priority activity.

If the Android’s memory manager needs to free up memory, it looks at the activity stack to determine the priority of the activities and which ones can be closed.

Monday, 31 March 2014 00:00

Let someone else manage your downloads!

The DownloadManager

Android DownloadManager tutorial for managing downloadsThe download manager was introduced in Android 2.3 (API level 9).

It’s a System Service that optimises the handling of long-running downloads in the background.

The download manager handles HTTP connections, monitors connectivity changes, reboots, and ensures each download completes successfully

Its good practice to use the download manager for most downloads, especially if the download continues between user sessions or if success is important.

Wednesday, 26 March 2014 00:00

AsyncTasks do it in the background

The golden thread

asyncTask tutorial icon

All Android components (like activities and services) start on the main thread. This is the thread that the user interacts with.

You need to keep this thread clear so that the app does not hang. It’s a good idea to put all time-consuming processes on a separate thread.

Put file operations, network lookups, database interaction, etc. on a background thread.

Monday, 24 March 2014 00:00

 

Doing it on the quiet: how to use an IntentService

intentService iconYou should do time consuming work, like downloading files, on a separate thread.

This will free up the main thread so your user can carry on using the app.

IntentServices are the preferred way for doing long running background operations.

You can request an IntentService from any of your fragments or activities. The requests are queued and handled one-after-the-other. The IntentService stops once all the requests have been handled.

Saturday, 22 March 2014 00:00

Start me up: Starting an activity to get a result

Starting activity for result - result iconSometimes, you may need to get data from another activity. That activity could be in your app or in another app.

You could use startActivityForResult() to get that data for you.

Thursday, 20 March 2014 00:00

Exchanging primitive data between activities

dataXchange iconYou may want to pass data from one activity to another.

It all depends on the type of data

You could put the data in a central point and then access it from anywhere.

Here are some of the ways to do that:

Wednesday, 19 March 2014 00:00