Example usage for android.widget ActivityChooserModel getActivity

List of usage examples for android.widget ActivityChooserModel getActivity

Introduction

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

Prototype

@UnsupportedAppUsage
public ResolveInfo getActivity(int index) 

Source Link

Document

Gets an activity at a given index.

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;
        }/*from ww w  . j  a  v a 2s  .  c  o m*/
    }
    Log.i(TAG, "<getErrMsgWhenStartActivityFail> return null");
    return null;
}