通过Android上的原生Twitter应用打开Twitter推文

vie*_*one 4 twitter android

浏览器可以使用以下格式的链接打开推文:

http://twitter.com/1Direction_X/statuses/197752514391715842

如何通过我的应用程序中的本机Twitter应用程序打开上述推文.

使用iOS,我可以通过以下声明:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://status?id=197752514391715842"]];
Run Code Online (Sandbox Code Playgroud)

谢谢!

Tas*_*sha 14

在Android上,您可以使用此链接在本机Twitter应用程序中打开推文

叽叽喳喳://状态STATUS_ID = 197752514391715842

  • 如果你想在浏览器中查看特定的推文,你会使用这样的意图:`Intent tweet_in_browser = new Intent(Intent.ACTION_VIEW,Uri.parse("http://twitter.com/<screen_name>/status/" <tweet_id>"));`如果你想在Twitter原生应用中查看特定的推文,你会使用这样的意图:`Intent tweet_in_native_app = new Intent(Intent.ACTION_VIEW,Uri.parse("twitter:// status?status_id = <tweet_id>"));`我使用twitter4j库查询推文,然后使用推文上的getId()函数获取<tweet_id>. (6认同)