Code example for Intent

Methods: getStringExtraresolveActivityInfotoUri

0
        mListener.shortcutPicked(appUri, getFriendlyShortcutName(intent), bmp, false);
    } 
 
    private String getFriendlyActivityName(Intent intent, boolean labelOnly) {
        PackageManager pm = mParent.getActivity().getPackageManager();
        ActivityInfo ai = intent.resolveActivityInfo(pm, PackageManager.GET_ACTIVITIES);
        String friendlyName = null;
 
        if (ai != null) {
            friendlyName = ai.loadLabel(pm).toString();
            if (friendlyName == null && !labelOnly) {
                friendlyName = ai.name;
            } 
        } 
 
        return friendlyName != null || labelOnly ? friendlyName : intent.toUri(0);
    } 
 
    private String getFriendlyShortcutName(Intent intent) {
        String activityName = getFriendlyActivityName(intent, true);
        String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
 
        if (activityName != null && name != null) {
            return activityName + ": " + name;
        } 
        return name != null ? name : intent.toUri(0);
    } 
 
    public String getFriendlyNameForUri(String uri) {
        if (uri == null) {
            return null;