I have a IntentService, Suppose I launch it today 27/12/2015.
I want it to wait for a specific date and time i.e 05/01/2016 08:54 AM, On this date and time i want it call a method to do something.
I have a IntentService, Suppose I launch it today 27/12/2015.
I want it to wait for a specific date and time i.e 05/01/2016 08:54 AM, On this date and time i want it call a method to do something.
SO i finally did it, posting the answer here for anyone who needs it, it is not the best way but its a way to get the job done the only solution i can came up with and stop voting down my question.
String userTime = textFiled1.getText().toString();
String userDate = textField2.getText().toString();
for(;;){
Calendar c = Calendar.getInstance();
SimpleDateFormat date = new SimpleDateFormat("d/M/yy");
SimpleDateFormat time = new SimpleDateFormat("h:mm");
Time = time.format(c.getTime());
Date = date.format(c.getTime());
if(userDate.equals(Date)){
if(userTime.equals(Time)){
// your code;
break;
}
}
}