HistoryProvider

Additional

Language
Java
Version
N/A
Created
Jan 5, 2017
Updated
Apr 1, 2017 (Retired)
Owner
Ishmeet Singh (Ishmeetsingh97)
Contributor
Ishmeet Singh (Ishmeetsingh97)
1
Activity
Badge
Generate
Download
Source code

HistoryProvider


History Provider is a simple library that stores your typed history inside a Database using the concept of Content providers, making the history database available to any application in the phone.

Installation

Add gradle dependency with command:

dependencies {
    compile 'org.ishmeetsingh.androbot:historyprovider:1.0.0'
    }

By using Maven:

<dependency>
  <groupId>org.ishmeetsingh.androbot</groupId>
  <artifactId>historyprovider</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Implementation

These steps are required to implement HistoryProvider in your Android Project:

  1. Make a new class and implements Cursor Loader android.app.LoaderManager.LoaderCallbacks<Cursor> and Override all the methods.
  2. Make an Listview and make an Adapter for it.
  3. In the MainActivity, Define an EditText by findViewById() and make a method to store words in the Database like this:
String name = EditText_Name.getText().toString().trim();
ContentValues values = new ContentValues();
values.put(WordContract.WordEntry.COLUMN_WORD_NAME,name);
Uri newUri = getContentResolver().insert(WordContract.WordEntry.CONTENT_URI, values);

FULL IMPLEMENTATION FOR ABOVE STEPS IS PROVIDED IN THE SAMPLE APP.

Additional Important Requirement:

Define the Content Provider in the Manifest file like this(No Values should be changed here excluding the provider name):

<provider
android:name="com.example.historyprovider_library.WordsProvider"
android:authorities="com.example.android.words"
android:enabled="true"
android:exported="true"
android:multiprocess="true" />

For any problems using HistoryProvider, Refer the Sample App or Contact me at ishmeet.1136@gmail.com