Intent实现跳转到网页,其他app的界面

  private void jumpToUrl() {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        Uri content_url = Uri.parse("https://www.baidu.com/");
        intent.setData(content_url);
        startActivity(intent);
    }

    private void jumpToMicroTest() {
     ComponentName componentName=new ComponentName("com.lany.screenshot","com.lany.screenshot.MainActivity");
        Intent intent = new Intent();
        intent.setComponent(componentName);
        intent.setAction(Intent.ACTION_VIEW);
        intent.putExtra("Version", getSimpleVersionInfo());
        intent.putExtra("buildNumber", buildNumber);   
        startActivity(intent);
    }

除了跳转,还可以附带数据,注意在跳转到其他app时,跳转到的app必须在跳转到的界面的manifest文件中定义exported=true,否则无法正常跳转。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值