Java Code Examples for android.content.ComponentName.compareTo()

The following are Jave code examples for showing how to use compareTo() of the android.content.ComponentName class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DroidPlugin   File: ComponentNameComparator.java   Source Code and License Vote up 6 votes
@Override
public int compare(ComponentName lhs, ComponentName rhs) {
    if (lhs == null && rhs == null) {
        return 0;
    } else if (lhs != null && rhs == null) {
        return 1;
    } else if (lhs == null && rhs != null) {
        return -1;
    } else {
        if (TextUtils.equals(lhs.getPackageName(), rhs.getPackageName()) && TextUtils.equals(lhs.getShortClassName(), rhs.getShortClassName())) {
            return 0;
        } else {
            return lhs.compareTo(rhs);
        }
    }
}