title: How to get the maximum id values and update the data to the id?
body: <p>I am facing the issue in querying the maximum id values and also want to update the data to the maximum id .</p>
  
  <pre><code>  public void addDataToRealm()
      {
          int key;
          realm.beginTransaction();
          detailsModel = realm.createObject(DetailsModel.class, id);
          detailsModel.setName(name.getText().toString());
          detailsModel.setPlace(place.getText().toString());
          detailsModel.setAddress(address.getText().toString());
          realm.commitTransaction();
          id++;
  }
  </code></pre>
  
  <p>In the above code i am incrementing the id value for each transaction.
  Is it possible to get the maximum id values from the realm database and need to update the values for the maximum id.Please help me how to solve this.</p>