Mar*_*cam 4 twitter android share
我呼吁Twitter分享文本.无需更改代码,从一天到另一天,此调用已停止工作.
意图是:
Intent share = new Intent(Intent.ACTION_VIEW);
share.setClassName("com.twitter.android",
"com.twitter.android.PostActivity");
share.setType("text/plain");
share.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_share_twitter));
share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivityForResult(share, SHARE_TWITTER);
Run Code Online (Sandbox Code Playgroud)
谢谢
问题是最新的Twitter Android应用更新(4.1.9)
您调用的操作已更改为" com.twitter.applib .PostActivity".试试这个以防止在旧/新Twitter版本中启动Exception:
try{
startActivityForResult(share, SHARE_TWITTER);
}catch(Throwable e){
share.setClassName("com.twitter.android", "com.twitter.applib.PostActivity");
try{
startActivityForResult(share, SHARE_TWITTER);
}catch(Throwable e2){
Log.e(TAG, e2.toString());
}}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1868 次 |
| 最近记录: |