How to prevent the activity from loading twice on pressing the button
Add this to your Activity definition in AndroidManifest.xml… android:launchMode = “singleTop” For example: <activity android:name=”.MainActivity” android:theme=”@style/AppTheme.NoActionBar” android:launchMode = “singleTop”/>