'How to check Edittext value If User Enter existing Value Value cant be Add in List?
As you can see I am trying to add value in list but When I am Trying to add Existing Value In value is inserted
mylist = new ArrayList<>();
mylist.add(text);
Log.d("mylist",mylist.toString());
for (int i=0;i<mylist.size();i++) {
if(mylist.contains(mylist.get(i))) {
Toast.makeText(MainActivity.this, ""+ mylist.get(i), Toast.LENGTH_SHORT).show();
Log.d("dataa",mylist.get(i));
}
}
Solution 1:[1]
Condition mylist.contains(mylist.get(i)) is always true.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TanZhenxing |
