HistoryProvider_Library
Ishmeetsingh97
30
Visit GitHub RepoDatabase

HistoryProvider

API Android Arsenal Android Dev Digest License
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.

alt tag

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

Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT