English 中文(简体)
使用ACTION_SEND向twitter发布短消息,向gmail发布长消息
原标题:Posting short messages to twitter and long messages to gmail using ACTION_SEND

使用ACTION_SEND可以将消息发布到各种共享服务,如gmail、facebook、twitter等。大多数服务的消息长度都相当长,但twitter尤其短(140个字符)。

当Intent.createChooser()对话框出现时,用户事先不知道要选择哪个服务,有没有办法构建一个意向,从而为twitter生成短消息,但为其他服务生成长消息?

问题回答

也许你可以尝试在你的应用程序中使用twitter分离共享作为一个选项。在某些编辑文本框中从应用程序内部获取文本,验证并检查其是否少于140个字符,然后发送文本。即使在这种情况下,当您调用ACTION_SEND时,用户也可以看到所有选项,但这些选项至少限制为140个字符。

Intent i=new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, R.string.share_subject);
i.putExtra(Intent.EXTRA_TEXT, ...);
startActivity(Intent.createChooser(i, R.string.share_title));

你也可以尝试使用Bitly API来缩短发布在twitter上的URL





相关问题
how does gmail detect mouse movement?

if you are inactive on gmail, by not moving your mouse for a while, it changes your chat status to orange which means idle. but when you start moving the mouse again it turns it back to green meaning ...

reading mails using python

how do i read mails from my mail box using python?? import getpass, imaplib M = imaplib.IMAP4( IMAP4.gmail.com:993 ) M.login(getpass.getuser(), getpass.getpass()) M.select() typ, data = M.search(None,...

SMTP Service not available

I am trying to create a web application which upon entering your email address and message , sends an email with this information from the email address. I used this: try { ...

How to auto log into gmail atom feed with Python?

Gmail has this sweet thing going on to get an atom feed: def gmail_url(user, pwd): return "https://"+str(user)+":"+str(pwd)+"@gmail.google.com/gmail/feed/atom" Now when you do this in a browser, ...

Can I build an addin for Gmail?

Is there a way I can create an addin for my Gmail account? Is GreaseMonkey the only real way? I use Gmail for customer service, and I d like to create a tool that looks up the customer and preps a ...

Web Link in a mail is not rendering as link in yahoo

string from = "abc@gmail.com"; string to = "xyz@gmail.com,xyz@yahoo.co.in"; string password="abcxyz"; MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(to); mail.From = new ...

热门标签