Java / Android Sort ArrayList

How to sort an ArrayList in Android: Following code is describing, how to sort an Android / Java array list of user defined class. Collections.sort(empList, new Comparator<Employee>(){ public int compare(Employee emp1, Employee emp2) { return emp1.getFirstName().compareToIgnoreCase(emp2.getFirstName()); } });

Write your own Background Service in Android

Service: is one of core component of Android. Service have not any user interface, like dialogboxe or buttons etc. Service runs in background. We use service for long process like fetch long (time consuming) data from network, play sound in background or some process where user interaction is not necessary.