Add the following dependency to your module-level build.gradle

implementation "androidx.security:security-crypto:1.0.0-rc03"

The existing implementation of PreferenceManager.java

The new implementation with EncryptedSharedPreferences

Add below methods to PreferenceManager.java which transfers all the existing prefs to encrypted shared prefs.

Call migrateToEncryptedSharedPreferences() on app start to perform migration from SharedPreferences to EncryptedSharedPreferences.

PreferenceManager.getInstance(getContext()).migrateToEncryptedSharedPreferences(getContext());

Make sure once the migration is completed successfully keep some pref which will indicate whether migration is pending or completed in order to avoid executing migration each time app starts.


  1. Add Navigation Architecture Component & Material Design Dependencies
//navigation architecture component
implementation “androidx.navigation:navigation-fragment-ktx:2.3.0”
implementation “androidx.navigation:navigation-ui-ktx:2.3.0”
// material design
implementation ‘com.google.android.material:material:1.2.0’

2. Create Menu Resource for Bottom Navigation View (res/menu/menu_bottom_sheet_main.xml)

<?xml version=”1.0" encoding=”utf-8"?>
<menu xmlns:android=”http://schemas.android.com/apk/res/android"
<item
android:id=”@+id/nav_personal”
android:icon=”@drawable/ic_personal
android:title=”Personal” />
<item
android:id=”@+id/nav_transaction”
android:icon=”@drawable/ic_transaction
android:title=”Transaction” />
<item
android:id=”@+id/nav_promotional”
android:icon=”@drawable/ic_promotional
android:title=”Promotional” />
<item
android:id=”@+id/nav_blocked”
android:icon=”@drawable/ic_blocked
android:title=”Blocked” />
</menu>…

Jay Patel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store