Android -- 分享功能和打开指定程序
打开指定程序
Intent intent = new Intent(); ComponentName cmp = new ComponentName("com.sina.weibo","com.sina.weibo.EditActivity"); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(cmp); startActivityForResult(intent, 0);
另:几个常用的Package命令:
新浪微博(编辑界面):com.sina.weibo com.sina.weibo.EditActivity
腾讯微博(编辑界面):com.tencent.WBlog com.tencent.WBlog.activity.MicroblogInput
微信: com.tencent.mm com.tencent.mm.ui.LauncherUI
QQ: com.tencent.mobileqq com.tencent.mobileqq.activity.HomeActivity
分享
Intent intent=new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT,"分享"); intent.putExtra(Intent.EXTRA_TEXT, "hello,weibo!"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(intent, "share"));
其中 intent.putExtra(Intent.EXTRA_TEXT, "hello,weibo!");
我是天王盖地虎的分割线
作者:我爱物联网
出处:http://yydcdut.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://yydcdut.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。