title: How to reset AtomicInteger unique Id in Android?
body: <p>I want to create a unique Id with reset button. I have a class <code>ViewId</code>.<code>ViewId</code> class contain <code>AtomicInteger</code>. <code>AtomicInteger</code> create unique Id successfully.But I want to reset unique Id using a button.So please help me to reset and create unique id again.</p>
  
  <p><code>ViewId</code> Class :</p>
  
  <pre><code>import java.util.concurrent.atomic.AtomicInteger;
  
  public class ViewId {
  
  private static ViewId INSTANCE = new ViewId();
  
  private AtomicInteger seq;
  
  private ViewId() {
      seq = new AtomicInteger(0);
  }
  
  public int getUniqueId() {
      return seq.incrementAndGet();
  }
  
  public static ViewId getInstance() {
      return INSTANCE;
  }
  }
  </code></pre>
  
  <p><code>MainActivity</code> Class :</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  EditText editValue;
  ViewId viewId = ViewId.getInstance();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      editValue = (EditText)findViewById(R.id.editText);
  
  }
  
  // Increment Button
  public void floatIncrement(View view) {
      Log.e("Incremented value is : ", String.valueOf(viewId.getUniqueId()));
  }
  
  // Reset Button
  public void resetBtn(View view) {
      // reset here
  }
  }
  </code></pre>