title: How to Clear Database in Realm in Android
body: <p>I want to clear whole database when a user press logout button and loads a new data when another user login.I tried many solutions like</p>
  
  <pre><code>try {
          Realm.deleteRealm(realmConfiguration);   
      } catch (Exception ex){
          throw ex;
      }
  </code></pre>
  
  <p>Also</p>
  
  <pre><code> try {
          Realm.deleteRealmFile(getActivity());
          //Realm file has been deleted.
      } catch (Exception ex){
          ex.printStackTrace();
          //No Realm file to remove.
      }
  </code></pre>
  
  <p>But neither of the code works.
  Thanks in advance.</p>