Giter Club home page Giter Club logo

android-content-provider-example's Introduction

Android content provider example

About

A small app that demonstrates how to build a custom content provider and perform CURD operations on the content.

Classes and their descriptions

The application has several class files that build up the content provider along with other class files that contain the logic for the GUI. Below is a list of all the classes and their descriptions.

  • CountryContract : Country contract is a class made to simplify creation of uniform resource identifiers (URI). It contains all the necessary information to create URIs using baseColumns and an custom built interface for country columns.
  • CountryDatabase : This class extends SQLiteOpenHelper class which allows for creation of the SQLite Database along with default data. It also has an interface to let other classes know which database this class contains.
  • CountryProvider : This class extends ContentProvider, it provides a CRUD interface to manage the database contents.
  • Country : A class created to store and retrieve country information to and from the database. It has six fields ( _id, name, capital, population, area, lang)  with getters and setter methods.
  • CountryListLoader : This class extends AsyncTaskLoader<E>, it is used to load information from the database asynchronously when the application starts up or makes any changes. It makes use of ContentResolver to query the data and Cursor to iterate through the data.
  • CountryCustomAdapter : This class extends ArrayAdapter<E>, it is used to initialize the data into the list that displays a list of country. It also contains the logic for handling edit and delete functions.  
  • CountryListFragment : extends ListFragment and implements LoaderManager.LoaderCallback<E>, it is used to bind the data to CountryCustomAdapter by loading the list from CountryListLoader.
  • MainActivity : This class is the entry point for the application. It extends FragmentActivity and It sets up a CountryListFragment to generate the list at start. It also defines the logic for adding new entries.
  • AddActivity : Extends FragmentActivity, it contains logic for add activity screen. It uses add_edit.xml as its layout.
  • EditActivity : Extends FragmentActivity, it contains logic for edit activity screen. It uses add_edit.xml as its layout.
  • CountryDialog : Extends DialogFragment, it contains logic for confirmation screen when deleting an entry.

Author

  • Balraj Singh Bains

Note: This application was built as a part of Heriot Watt University Coursework for Mobile Communications and Programming and was forked from there to showcase on Github.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.