Back button closes the activity in fragments
**Checklist**
- [x] Bug Report - The issue you are reporting might be there already. Please search on the [issues tracker](https://github.com/openfoodfacts/openfoodfacts-androidapp/issues) before creating or reporting a issue.
- [x] Before reporting, please ensure (if you can) that you have tested it with the latest (dev) version of the software.
- [x] Don't forget to tag your issue, it makes it easier to discover.

**Summary:** 

Back button closes the activity instead of going back to Home. Examples:

- Search by barcode
- Allergen alert
- Preferences
- Offline edit

**Steps to reproduce:** 

Go to the section. Press back button. 

**Expected behavior:** 

Go to home

**Observed behavior:** 

Activity closes
diff --git a/app/src/main/java/openfoodfacts/github/scrachx/openfood/views/MainActivity.java b/app/src/main/java/openfoodfacts/github/scrachx/openfood/views/MainActivity.java
index 75eabfab3..7317c19ad 100644
--- a/app/src/main/java/openfoodfacts/github/scrachx/openfood/views/MainActivity.java
+++ b/app/src/main/java/openfoodfacts/github/scrachx/openfood/views/MainActivity.java
@@ -172,7 +172,8 @@ public class MainActivity extends BaseActivity implements CustomTabActivityHelpe
                     }
 
                     @Override
-                    public void onDrawerClosed(View drawerView) {}
+                    public void onDrawerClosed(View drawerView) {
+                    }
 
                     @Override
                     public void onDrawerSlide(View drawerView, float slideOffset) {
@@ -295,7 +296,7 @@ public class MainActivity extends BaseActivity implements CustomTabActivityHelpe
                     }
 
                     if (fragment != null) {
-                        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commit();
+                        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).addToBackStack(null).commit();
                     } else {
                         // error in creating fragment
                         Log.e("MainActivity", "Error in creating fragment");
['app/src/main/java/openfoodfacts/github/scrachx/openfood/views/MainActivity.java']