android.content.Intent#toUri ( )源码实例Demo

下面列出了android.content.Intent#toUri ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: sana.mobile   文件: SSIActivityRunner.java
@Override
public Intent next(Intent response) {
    Intent request = response.getParcelableExtra(Intents.EXTRA_REQUEST);
    // Log input and output if we are debugging
    String reqLog = (request != null) ? request.toUri(Intent.URI_INTENT_SCHEME) : "null";
    String respLog = (response != null) ? response.toUri(Intent.URI_INTENT_SCHEME) : "null";
    Logf.D(TAG, "next(Intent,Intent)", String.format("request=%s;response=%s", reqLog, respLog));

    // check for a null intent equivalent to CANCEL
    if (response.getAction().equals(Intents.ACTION_CANCEL)) {
        response = handleCancel(request, response);
    } else {
        response = handleOk(request, response);
    }
    return response;
}
 
源代码2 项目: sana.mobile   文件: DefaultActivityRunner.java
@Override
public Intent next(Intent response) {
    // get the previous state
    Intent request = (stack.size() >= 1) ? stack.pop() : null;

    // Log request and response
    String reqLog = (request != null) ? request.toUri(Intent.URI_INTENT_SCHEME) : "null";
    String respLog = (response != null) ? response.toUri(Intent.URI_INTENT_SCHEME) : "null";
    Logf.I(TAG, "next(Intent)", String.format("request=%s;response=%s", reqLog, respLog));

    // check for a null intent equivalent to CANCEL
    if (response == null) {
        stack.push(handleCancel(request));
    } else {
        stack.push(handleOk(request, response));
    }
    return Intents.copyOf(stack.peek());
}
 
源代码3 项目: GravityBox   文件: AppPickerPreference.java
private String convertOldValueFormat(String oldValue) {
    try {
        String[] splitValue = oldValue.split(SEPARATOR);
        ComponentName cn = new ComponentName(splitValue[0], splitValue[1]);
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.setComponent(cn);
        intent.putExtra("mode", MODE_APP);
        String newValue = intent.toUri(0);
        setValue(newValue);
        Log.d(TAG, "Converted old AppPickerPreference value: " + newValue);
        return newValue;
    } catch (Exception e) {
        Log.e(TAG, "Error converting old AppPickerPreference value: " + e.getMessage());
        return null;
    }
}
 
@Override public Drawable getActivityIcon(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityIcon(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadIcon(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override
public Drawable getActivityLogo(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityLogo(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadLogo(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override public Drawable getActivityIcon(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityIcon(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadIcon(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override
public Drawable getActivityLogo(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityLogo(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
            intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadLogo(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override
public Drawable getActivityLogo(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityLogo(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadLogo(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override public Drawable getActivityIcon(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityIcon(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadIcon(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
源代码10 项目: openlauncher   文件: Tool.java
public static String getIntentAsString(Intent intent) {
    if (intent == null) {
        return "";
    } else {
        return intent.toUri(0);
    }
}
 
源代码11 项目: ToGoZip   文件: SettingsActivity.java
private boolean onCmdSend(CharSequence title) {
    ZipStorage storage = SettingsImpl.getCurrentZipStorage(this);
    Intent intent = new Intent(Intent.ACTION_SEND);
    Uri contentUri = Uri.parse(storage.getFullZipUriOrNull());
    String mime = "application/zip";

    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
            Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);


    // EXTRA_CC, EXTRA_BCC
    // intent.putExtra(Intent.EXTRA_EMAIL, new String[]{toAddress});

    intent.putExtra(Intent.EXTRA_SUBJECT, SettingsImpl.getZipFile());

    // intent.putExtra(Intent.EXTRA_TEXT, body);

    intent.putExtra(Intent.EXTRA_STREAM, contentUri);

    intent.setType(mime);

    final String debugMessage = "SettingsActivity.onCmdSend(" +
            title +
            ", startActivity='" + intent.toUri(0)
            + "')";
    try {
        final Intent chooser = Intent.createChooser(intent, title);
        chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
        this.startActivity(chooser);
        if (Global.debugEnabled) {
            Log.d(Global.LOG_CONTEXT, debugMessage);
        }
    }
    catch(Exception ex) {
        Log.w(Global.LOG_CONTEXT, debugMessage, ex);
    }

    return true;
}
 
@Override
public Drawable getActivityLogo(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityLogo(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadLogo(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override public Drawable getActivityIcon(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityIcon(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadIcon(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override
public Drawable getActivityBanner(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityBanner(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
            intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadBanner(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override
public Drawable getActivityLogo(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityLogo(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadLogo(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override public Drawable getActivityIcon(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityIcon(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadIcon(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
@Override
public Drawable getActivityBanner(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityBanner(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
            intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadBanner(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
源代码18 项目: sana.mobile   文件: DispatchService.java
public Message obtainRequest(Handler handler, int who, Intent intent) {
    int what = Uris.getDescriptor(intent.getData());
    Message msg = handler.obtainMessage(what,
            intent.toUri(Intent.URI_INTENT_SCHEME));
    msg.arg1 = intent.filterHashCode();
    msg.arg2 = REQUEST;
    msg.obj = intent.toUri(Intent.URI_INTENT_SCHEME);

    return msg;
}
 
@Override
public Drawable getActivityLogo(Intent intent)
        throws NameNotFoundException {
    if (intent.getComponent() != null) {
        return getActivityLogo(intent.getComponent());
    }

    ResolveInfo info = resolveActivity(
        intent, PackageManager.MATCH_DEFAULT_ONLY);
    if (info != null) {
        return info.activityInfo.loadLogo(this);
    }

    throw new NameNotFoundException(intent.toUri(0));
}
 
源代码20 项目: RelaxFinger   文件: AppUtils.java
public static String getIntentUri(ResolveInfo resolveInfo){


        Intent intent = new Intent();

        String pkgName = resolveInfo.activityInfo.packageName;
        String clsName = resolveInfo.activityInfo.name;

        intent.setComponent(new ComponentName(pkgName,clsName));

        return intent.toUri(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
 
 方法所在类
 同类方法