i am developing an application for android and would like for my users to be able to post some information from my application to their twitter feed. i know how to make this work by building a VIEW intent and forwarding the user to the android built-in web browser (thanks to stack overflow!) However, now that there is an official Twitter application, I would like to be able to use the twitter applications activity (if it is installed) to make the post. However, I can not find any developer documentation on what the Twi开发者_如何学Ctter Intent for Android is called. Can someone provide a short snippet of sample code that includes that text of the Intent to use?
Can someone provide a short snippet of sample code that includes that text of the Intent to use?
The official Twitter app may support the ACTION_SEND
Intent
, like Twidroid does. If so, this blog post describes the basic techinque (forgive any formatting issues).
Well, actually... the best thing you can do is using the twitter4j api: http://twitter4j.org/en/index.html
That way you can easly build a custom, simple client for twitter that will make your users feel more confortable. And your app wont depend on the official twitter client which probably is not installed in some handsets.
Actually, it is possible to get the official app in the list now:
Intent emailIntent = new Intent(Intent.ACTION_SEND);
//emailIntent.setType("message/rfc822"); // This was restricting it
emailIntent.setType("text/plain"); // The twitter app is receptive to this
精彩评论