I am using an ArrayList within my code which gets populated by a EditText field but I am wanting to limit the ArrayList so it can only hold 10 values. After 10 values have been added if another tries to get added I just need it to not add into the Array. Anyone got any ideas how to do that?
private static ArrayList<String> playerList = new ArrayList<String>();
In your handler method:
Edit: Your mistake is here:
You should check the size inside the
onClickListener, not outside: