-1

I'm developing an android application and I want to can share in a tweet a picture. I search for tutorials and all of them have to authentificate the user before can post a tweet. Is there any way to use the account that's stored on your phone instead of authenticating the user again?

I don't want to have a share button, I want that like in iPhone can post a tweet.

If anyone know of other toturial that works and it's better please tell me, I don't want a share button, only I want to tweet.

Thanks

Gabriel Esteban
  • 752
  • 2
  • 9
  • 34
  • "I don't want to have a share button" -- well-written apps allow their *users* to decide how each *user* wants to share the *user's* content, which may or may not involve Twitter. – CommonsWare May 12 '12 at 16:08
  • Yes, but the app that I'm develpoing is not like a game that want to share the result, is more like a twitter client. – Gabriel Esteban May 12 '12 at 17:06
  • If it is a Twitter client, then the user will need to provide you (or Twitter directly via OAuth) with account credentials, because presumably they are not using any other Twitter client. – CommonsWare May 12 '12 at 17:10
  • I salved finally with a selected share intent. http://stackoverflow.com/questions/8308666/how-to-force-share-intent-to-open-a-specific-app thanks for all – Gabriel Esteban May 12 '12 at 17:35
  • Use shareIntent http://stackoverflow.com/questions/8308666/how-to-force-share-intent-to-open-a-specific-app –  May 16 '12 at 14:13

1 Answers1

2

Use shareIntent, as described here:

public void shareTwitter() {
        String message = "Your message to post";
        try {
            Intent sharingIntent = new Intent(Intent.ACTION_SEND);
            sharingIntent.setClassName("com.twitter.android","com.twitter.android.PostActivity");
            sharingIntent.putExtra(Intent.EXTRA_TEXT, message);
            startActivity(sharingIntent);
        } catch (Exception e) {
            Log.e("In Exception", "Comes here");
            Intent i = new Intent();
            i.putExtra(Intent.EXTRA_TEXT, theObject.getName());
            i.setAction(Intent.ACTION_VIEW);
            i.setData(Uri.parse("https://mobile.twitter.com/"));
            startActivity(i);
        }
    }
Community
  • 1
  • 1