zoukankan      html  css  js  c++  java
  • 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!");

    我是天王盖地虎的分割线                                                                 

  • 相关阅读:
    可能会搞砸你的面试:你知道一个TCP连接上能发起多少个HTTP请求吗?
    iOS笔记055
    iOS笔记053- Quartz2D-练习
    iOS笔记052- Quartz2D-绘图
    IOS笔记051-手势使用
    IOS笔记050-事件处理
    IOS笔记049-UITabBarController
    IOS笔记048-数据存储
    IOS笔记047-代理传值和block传值
    IOS笔记046-UIApplication/导航控制器
  • 原文地址:https://www.cnblogs.com/yydcdut/p/3888189.html
Copyright © 2011-2022 走看看