title: Change FrameLayout dynamically in a BottomNavigationView
body: <p>So, my problem is this, I want change the layout when a different button is clicked in the bottom bar. <br>
  I want to show different widget when each button is clicked. 
  My activity_main.xml is this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context="com.codanimex.android.prova.MainActivity"&gt;
  
      &lt;FrameLayout
          android:id="@+id/content"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"&gt;
  
          &lt;TextView
              android:id="@+id/message"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginBottom="@dimen/activity_vertical_margin"
              android:layout_marginLeft="@dimen/activity_horizontal_margin"
              android:layout_marginRight="@dimen/activity_horizontal_margin"
              android:layout_marginTop="@dimen/activity_vertical_margin"
              android:text="@string/title_home" /&gt;
  
      &lt;/FrameLayout&gt;
  
      &lt;android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"
          android:background="?android:attr/windowBackground"
          app:menu="@menu/navigation" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>My MainActivity.java is:</p>
  
  <pre><code>package com.codanimex.android.prova;
  
  import android.os.Bundle;
  import android.support.annotation.NonNull;
  import android.support.design.widget.BottomNavigationView;
  import android.support.v7.app.AppCompatActivity;
  import android.view.MenuItem;
  import android.widget.TextView;
  
  public class MainActivity extends AppCompatActivity {
  
      private TextView mTextMessage;
  
      private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
              = new BottomNavigationView.OnNavigationItemSelectedListener() {
  
          @Override
          public boolean onNavigationItemSelected(@NonNull MenuItem item) {
              switch (item.getItemId()) {
                  case R.id.navigation_home:
                      mTextMessage.setText(R.string.title_home);
                      return true;
                  case R.id.navigation_dashboard:
                      mTextMessage.setText(R.string.title_dashboard);
                      return true;
                  case R.id.navigation_notifications:
                      mTextMessage.setText(R.string.title_notifications);
                      return true;
              }
              return false;
          }
  
      };
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mTextMessage = (TextView) findViewById(R.id.message);
          BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
          navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
      }
  
  }
  </code></pre>
  
  <p>If I have to use fragments, can you explain it? I could not understand their functioning. <br>
  Thanks for help.</p>