intent

作者: 会飞的狒狒 | 来源:发表于2019-06-12 00:09 被阅读0次

1.createChooser强制打开应用选择

Intent send = new Intent(Intent.ACTION_SEND);  
        send.setType("text/plain");  
        send.putExtra(Intent.EXTRA_TEXT, url);  
        send.putExtra(Intent.EXTRA_SUBJECT, title);    
        c.startActivity(Intent.createChooser(send, "share title"));

2.EXTRA_INITIAL_INTENTS组合多个intent打开选择

Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
Intent i2 = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
chooserIntent.putExtra(Intent.EXTRA_INTENT, i);
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{i2});
startActivity(chooserIntent);

3.指定和过滤应用
https://www.jianshu.com/p/9fd5363a9356

相关文章

网友评论

      本文标题:intent

      本文链接:https://www.haomeiwen.com/subject/qsehfctx.html