Example usage for android.widget ActivityChooserModel getActivityCount

List of usage examples for android.widget ActivityChooserModel getActivityCount

Introduction

In this page you can find the example usage for android.widget ActivityChooserModel getActivityCount.

Prototype

@UnsupportedAppUsage
public int getActivityCount() 

Source Link

Document

Gets the number of activities that can handle the intent.

Usage

From source file:com.android.gallery3d.app.PhotoPage.java

private String getErrMsgWhenStartActivityFail(ActivityChooserModel host, Intent intent) {
    int count = host.getActivityCount();
    for (int i = 0; i < count; i++) {
        ResolveInfo rInfo = host.getActivity(i);
        if (rInfo != null && rInfo.activityInfo != null && rInfo.activityInfo.name != null
                && rInfo.activityInfo.name.equals(intent.getComponent().getClassName())) {
            String res = mActivity.getString(
                    com.android.internal.R.string.activitychooserview_choose_application_error,
                    rInfo.loadLabel(mActivity.getPackageManager()));
            Log.i(TAG, "<getErrMsgWhenStartActivityFail> return " + res);
            return res;
        }/*  w  w w  .j a v a 2  s. c o  m*/
    }
    Log.i(TAG, "<getErrMsgWhenStartActivityFail> return null");
    return null;
}