How to run a permanent service in the background. For example I want my app to always run this method:
public void addToCalendar(){
myDB = CustomApplication.getDatabaseHelper();
ColorDrawable blue = new ColorDrawable(Color.BLUE);
for(int i=1;i <= myDB.getLastId();i++){
String dt = myDB.getDates(i);
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MM-yyyy");
Date teste = null;
try {
teste = sdf.parse(dt);
} catch (ParseException e) {
e.printStackTrace();
}
caldroidFragment.setBackgroundDrawableForDate(blue,teste);
}
}