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!");

    我是天王盖地虎的分割线                                                                 

  • 相关阅读:
    开发模型----快速原型模型
    开发模型--瀑布模型
    python_001
    Linux文件的类型与系统目录
    流程控制语句
    test命令
    排序sort && 取消重复行uniq
    sed命令——用来对文件数据的 选取、替换、删除
    颜色RGB大全
    Markdown的使用
  • 原文地址:https://www.cnblogs.com/yydcdut/p/3888189.html
Copyright © 2011-2022 走看看