Error starting "com.twitter.android.PostActivity"

I call Twitter's intention to share text. Without changing the code, from one day to another, this call stops working.

Purpose:

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

thanks

+4
source share
4 answers

The problem is the latest update of the Twitter Android application (4.1.9)

The action you invoke has been changed to "com.twitter. Applib .PostActivity". Try this to prevent throwing Exception on older / newer versions of Twitter:

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

2014 , Twitter , "com.twitter.android.composer.ComposerActivity".

+14

They changed the action that processes it ... you can try now by setting this for your intention:

   intent.setClassName("com.twitter.android", 
                     "com.twitter.composer.SelfThreadComposerActivity");
0
source

Twitter activity changed its name again, now it's called "com.twitter.android.composer.ComposerShareActivity".

-1
source

All Articles