Java Code Examples for

The following are Jave code examples for showing how to use getPreferredActivities() of the class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Paper-Launcher   File:   View Source Code Vote up 6 votes
private boolean isPaperLauncherDefault() {
    final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN);

    List<IntentFilter> filters = new ArrayList<>();

    String paperLauncherPackageName = mLauncherActivity.getPackageName();
    List<ComponentName> activities = new ArrayList<>();

    PackageManager packageManager = mLauncherActivity.getPackageManager();
    packageManager.getPreferredActivities(filters, activities, null);

    for (ComponentName activity : activities) {
        if (paperLauncherPackageName.equals(activity.getPackageName())) {
            return true;

    return false;