【发布时间】:2012-05-13 19:55:06
【问题描述】:
浏览器可以通过格式链接打开推文:
如何从我的应用程序中通过本机 Twitter 应用程序打开上述推文。
对于 iOS,我可以通过以下语句做到:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://status?id=197752514391715842"]];
谢谢!
【问题讨论】:
浏览器可以通过格式链接打开推文:
如何从我的应用程序中通过本机 Twitter 应用程序打开上述推文。
对于 iOS,我可以通过以下语句做到:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://status?id=197752514391715842"]];
谢谢!
【问题讨论】:
您通常使用Intent.ACTION_SEND 意图打开共享对话框,然后用户可以在其中选择 Twitter 应用程序。
我发现这个教程可以用来直接启动 twitter 应用程序: http://blog.rafaelsanches.com/2010/06/18/using-native-twitter-app-intent-to-share-on-android/
【讨论】:
在 Android 上,您可以使用此链接在原生 Twitter 应用中打开推文
twitter://status?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() 函数来获取