In my case Arraylist contains user define timings like{12:23,15:40,17:17...}. how can i print message when system time is equal to user timings.
Asked
Active
Viewed 67 times
-2
-
possible duplicate of [How does a ArrayList's contains() method evaluate objects?](http://stackoverflow.com/questions/2642589/how-does-a-arraylists-contains-method-evaluate-objects) – Phantômaxx Mar 28 '15 at 17:22
1 Answers
0
First make an array for this by below code
String s = "{12:23,15:40,17:17...}";
String newstring = s.replace("{").replace("}");
int size = StringUtils.countOccurrencesOf(newstring , ",");
String[] arrayString = new String[size];
Now Compare
for(int i=0; i<size; i++){
if(yoursystemtime.equals(newstring.split(",")[i])){
Toast.makeText(context, "equal", Toast.Lenght.Short).show();
}
}

Shadik Khan
- 1,217
- 1
- 8
- 18