android中 分享的写法

来源:互联网 发布:ubuntu cuda test 编辑:程序博客网 时间:2024/04/27 16:13
Log.i(TAG,"分享"+packname);Intent shareIntent = new Intent();shareIntent.setAction(Intent.ACTION_SEND);//需要指定意图的数据类型shareIntent.setType("text/plain");//shareIntent.putExtra("android.intent.extra.SUBJECT","分享");shareIntent.putExtra(Intent.EXTRA_SUBJECT,"分享");shareIntent.putExtra(Intent.EXTRA_TEXT,"推荐使用一个程序"+item.getAppname());shareIntent=Intent.createChooser(shareIntent,"分享");startActivity(shareIntent);

0 0