Use SharedPreferences for persistant data

User Preference Settings

SharedPreferences are not the same as the typical user preferences where one, for example selects the preferred default sound, text size, colours, etc. for an app.

Android for beginners. Building a Fuel Consumption Calculator with line by line commentary is aimed at those wanting to develop Android applications without having to dig through piles of technical jargon. It helps you build a working Android application step by step, with line by line commentary explaining each line of code. fuelCover

After working through the tutorial you will have a good understanding of Android application development and will be able to go on to build more complex applications with confidence.

The Consumption Calculator covers all the basics of an interactive Android applications. On first installation it displays a splash screen which checks whether or not a vehicle registration has already been saved. A Main menu then displays, allowing the user to either add a record, edit a record, delete a record or calculate the fuel consumption. The record contains the vehicle registration number, date of entry, odometer reading, total fuel bought and the total cost of the fuel. The record is saved in a Sqlite database.

The database can be searched by date or odometer reading to find a record or to calculate the fuel consumption between two dates or odometer values.

The tutorial takes you step by step, building the project, creating the activities and layout files. Explaining each step, describing each line of code.

You can download all the project files of the working application to validate your progress.

A must have resource for anyone wanting to learn Android application development. 

Available at