启动“com.twitter.android.PostActivity"时出错 [英] Error starting "com.twitter.android.PostActivity"

查看:64
本文介绍了启动“com.twitter.android.PostActivity"时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Twitter 上调用了一个意图来分享文本.在不更改代码的情况下,从一天到一天,此调用已停止工作.

I call a intent to Twitter to share a text. Without changing the code, from one day to another, this call has stopped working.

目的是:

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);

谢谢

推荐答案

问题是上次 Twitter Android 应用更新 (4.1.9)

The problem is the last Twitter Android app update (4.1.9)

您调用的操作已更改为com.twitter.applib.PostActivity".尝试这样做以防止在旧/新 Twitter 版本中启动异常:

The action that you call, have been changed to "com.twitter.applib.PostActivity". Try this to prevent the Exception launched in old/new Twitter versions:

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());                                              
    }}

这篇关于启动“com.twitter.android.PostActivity"时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆