Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 1.18 KB

File metadata and controls

26 lines (15 loc) · 1.18 KB

DaggerPreferenceRetrofitPersistance

An application with Dagger 2, shared preference, retrofit API and Room storage. Each and every concept is implemented in separate activity for beginners.

In my previous Git repo I have provide Dagger 2 in simple steps. It is available here.

Here in this repo I've used shared preference, API calling(Retrofit) and persistance storage(Room DB) with the help of dependency injection(Dagger 2).


Lets pop into the code:

  • SimpleActivity.java: - for simple Dagger 2 introduction and basic functionality (info available here)

  • PreferenceActivity.java: - for storing and retriving data from SharedPreferences

Preferences and utils will be injected through dagger component.

  • NetworkActivity.java: - for calling API using Retrofit

Retrofit setup and call is done in NetworkModule and injected in activity thought dagger.

  • PersistenceActivity.java: - for storing and retriving data from Room

Room setup and DAO is defined in PersistenceModule and injected in activity thought dagger.

Each specific component holds an respective custom scopes.