發表文章

目前顯示的是 3月, 2017的文章

Android - wechat share 微信分享

Intent: Intent intent = new Intent(); //選擇好友分享頁面 ComponentName comp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools.ShareToTimeLineUI"); intent.setComponent(comp); intent.setAction(Intent.ACTION_SEND_MULTIPLE); intent.putExtra("Kdescription", "我在測試"); intent.setType("image/*"); //添加Uri圖片 ArrayList<Uri> imageUris = new ArrayList<Uri>(); imageUris.add(getScreenShotTop()); ntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris); startActivity(intent); SDK: (compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.1.2')             //分享             String text = "測試分享文字";             // 初始化一个WXTextObject对象             WXTextObject textObj = new WXTextObject();             textObj.text = text;             // 用WXTextObject对象初始化一个WXMediaMessage对象             WXMediaMessage msg = new WXMediaMessage();             msg.mediaObject = tex

Android - 分享至其他APP

調用分享窗: public static void shareMsg(Context context,String msgText,String imgPath) {                 Intent intent = new Intent(Intent.ACTION_SEND);                 if (imgPath == null || imgPath.equals("")) {                         intent.setType("text/plain"); // 纯文本                 } else {                         File f = new File(imgPath);                         if (f != null && f.exists() && f.isFile()) {                                 intent.setType("image/*");                                 Uri u = Uri.fromFile(f);                                 intent.putExtra(Intent.EXTRA_STREAM, u);                         }                 }                 intent.putExtra(Intent.EXTRA_SUBJECT, "分享");                 intent.putExtra(Intent.EXTRA_TEXT, "我在用分享!");                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);                 context.startActivity(Intent.createChooser(int