logo logo

How to Post Twitter Status from Android

Home » Information Technology » Programming » Android » How to Post Twitter Status from Android

While developing one of my Android application, i found it was hard to find a good and simple tutorial on how to integrate Twitter into Android app.  There are some external java libraries over the net that can be used to integrate Twitter into Android app, but they lack of good documentation and tutorial on how to use it on Android. So i  made my own implementation using  Twitter4j and oauth-signpost library. In this tutorial, i create one sample Android project to show how to connect to Twitter, save it’s token and username on shared preferences so it can be used later to post status to Twitter.

I. Register Twitter Application

To enable user to post status to Twitter, first you have to create one Twitter application. Simply go to Twitter Apps page and register your application. Fill the ‘Application Name‘ with your desired name, it has to be unique. If you use a name that already exist (taken by someone), you’ll get a warning message.  On ‘Application Type’ option, choose ‘Browser’ , and because its a browser type application but used in mobile application, you can set it’s callback url on ‘Callback URL‘ field  with any url you want. On ‘Default Access type’, choose ‘Read and Write‘ to enable access to post status. Click save and if all things going well, you’ll get a page showing your consumer key and secret key. Copy these two keys for later use in Android app.

II. Android Integration

To integrate Twitter into Android app, you need four external jar files from two different libraries, Twitter4j and oauth-signpost. You can download latest version from Twitter4j download page or use the one included in my sample project (twitter4j-core-2.1.6.jar) and oauth-signpost from oauth-signpost download page (signpost-core-1.2.1.1.jar, signpost-commonshttp4-1.2.1.1.jar, signpost-jetty6-1.2.1.1.jar). Add the four external jars into your Android project (on Eclipse, right click on your project->properties then on Java Build Path click Add External JARs button to select files)

In my sample project, i create three helper classes (TwitterApp.java,  TwitterDialog.java, and TwitterSession.java) to handle authentication using Webview Dialog and session handler to save token and username on Shared Preferences.

Code implementation

1. Twitter Connection (TestConnection.java)

This example shows how to connect to Twitter, display webview dialog to authorize user then save user’s token and username on shared preference for later use.

public class TestConnect extends Activity {
	private TwitterApp mTwitter;
	private CheckBox mTwitterBtn;

	private static final String twitter_consumer_key = "xxx";
	private static final String twitter_secret_key = "xxx";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.main);

		mTwitterBtn	= (CheckBox) findViewById(R.id.twitterCheck);

		mTwitterBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				onTwitterClick();
			}
		});

		mTwitter 	= new TwitterApp(this, twitter_consumer_key,twitter_secret_key);

		mTwitter.setListener(mTwLoginDialogListener);

		if (mTwitter.hasAccessToken()) {
			mTwitterBtn.setChecked(true);

			String username = mTwitter.getUsername();
			username		= (username.equals("")) ? "Unknown" : username;

			mTwitterBtn.setText("  Twitter (" + username + ")");
			mTwitterBtn.setTextColor(Color.WHITE);
		}

		Button goBtn = (Button) findViewById(R.id.button1);

		goBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				startActivity(new Intent(TestConnect.this, TestPost.class));
			}
		});
	}

	private void onTwitterClick() {
		if (mTwitter.hasAccessToken()) {
			final AlertDialog.Builder builder = new AlertDialog.Builder(this);

			builder.setMessage("Delete current Twitter connection?")
			       .setCancelable(false)
			       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
			           public void onClick(DialogInterface dialog, int id) {
			        	   mTwitter.resetAccessToken();

			        	   mTwitterBtn.setChecked(false);
			        	   mTwitterBtn.setText("  Twitter (Not connected)");
			        	   mTwitterBtn.setTextColor(Color.GRAY);
			           }
			       })
			       .setNegativeButton("No", new DialogInterface.OnClickListener() {
			           public void onClick(DialogInterface dialog, int id) {
			                dialog.cancel();

			                mTwitterBtn.setChecked(true);
			           }
			       });
			final AlertDialog alert = builder.create();

			alert.show();
		} else {
			mTwitterBtn.setChecked(false);

			mTwitter.authorize();
		}
	}

	private final TwDialogListener mTwLoginDialogListener = new TwDialogListener() {
		@Override
		public void onComplete(String value) {
			String username = mTwitter.getUsername();
			username		= (username.equals("")) ? "No Name" : username;

			mTwitterBtn.setText("  Twitter  (" + username + ")");
			mTwitterBtn.setChecked(true);
			mTwitterBtn.setTextColor(Color.WHITE);

			Toast.makeText(TestConnect.this, "Connected to Twitter as " + username, Toast.LENGTH_LONG).show();
		}

		@Override
		public void onError(String value) {
			mTwitterBtn.setChecked(false);

			Toast.makeText(TestConnect.this, "Twitter connection failed", Toast.LENGTH_LONG).show();
		}
	};
}

First, create an instance of  TwiterApp class with context, consumer key and secret key as constructor’s parameters. Use hasAccessToken() method to check if there is previously saved session. If there is no saved session, call authorize() to open authorization dialog. If user allows the connection, his access token and user name will be saved on shared preferences. You can setup listener to handle on success and on error event by creating an instance of TwDialogListener and pass it to setListener() method.

2. Post Status (TestPost.java)

This example shows how to post Twitter status. If there is no previously saved session, display authorization dialog to allow user authorize the connection then post status using different thread.

public class TestPost extends Activity {
	private TwitterApp mTwitter;
	private CheckBox mTwitterBtn;
	private String username = "";
	private boolean postToTwitter = false;

	private static final String twitter_consumer_key = "xxxx";
	private static final String twitter_secret_key = "xxxx";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.post);

		Button postBtn 				= (Button) findViewById(R.id.button1);
		final EditText reviewEdit   = (EditText) findViewById(R.id.revieew);

		postBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String review = reviewEdit.getText().toString();

				if (review.equals("")) return;

				postReview(review);

				if (postToTwitter) postToTwitter(review);
			}
		});

		mTwitter = new TwitterApp(this, twitter_consumer_key,twitter_secret_key);

		mTwitter.setListener(mTwLoginDialogListener);

		mTwitterBtn	= (CheckBox) findViewById(R.id.twitterCheck);

		mTwitterBtn.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (mTwitter.hasAccessToken()) {
					postToTwitter = mTwitterBtn.isChecked();
				} else {
					mTwitterBtn.setChecked(false);
					mTwitter.authorize();
				}
			}
		});

		if (mTwitter.hasAccessToken()) {
			username 	= mTwitter.getUsername();
			username	= (username.equals("")) ? "No Name" : username;

			mTwitterBtn.setText("  Twitter  (" + username + ")");
		}
	}

	private void postReview(String review) {
		//post to server

		Toast.makeText(this, "Review posted", Toast.LENGTH_SHORT).show();
	}

	private void postToTwitter(final String review) {
		new Thread() {
			@Override
			public void run() {
				int what = 0;

				try {
					mTwitter.updateStatus(review);
				} catch (Exception e) {
					what = 1;
				}

				mHandler.sendMessage(mHandler.obtainMessage(what));
			}
		}.start();
	}

	private Handler mHandler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			String text = (msg.what == 0) ? "Posted to Twitter" : "Post to Twitter failed";

			Toast.makeText(TestPost.this, text, Toast.LENGTH_SHORT).show();
		}
	};
	private final TwDialogListener mTwLoginDialogListener = new TwDialogListener() {
		@Override
		public void onComplete(String value) {
			username 	= mTwitter.getUsername();
			username	= (username.equals("")) ? "No Name" : username;

			mTwitterBtn.setText("  Twitter  (" + username + ")");
			mTwitterBtn.setChecked(true);

			postToTwitter = true;

			Toast.makeText(TestPost.this, "Connected to Twitter as " + username, Toast.LENGTH_LONG).show();
		}

		@Override
		public void onError(String value) {
			mTwitterBtn.setChecked(false);

			Toast.makeText(TestPost.this, "Twitter connection failed", Toast.LENGTH_LONG).show();
		}
	};
}

Update 2011-10-01

- Fix authorization failed bug when attempt to authorize after logging out. This was caused by an exception (java.lang.IllegalStateException: consumer key/secret pair already set) was thrown by setOauthConsumer(consumerKey,secretKey) method of Twitter class. This method should be called once.

You can download  the source code here (with external jars) or via github here

Share
Related post:
bottom

258 Responses to “How to Post Twitter Status from Android”

  1. ganesh says:

    hey lorenz..

    this help me a lot thx for posting.. authentication is working proparly..but when i posting any text..its saying post failed plz help me….

  2. ganesh says:

    hey Lorenze

    thax for posting this artical, it help me lot..I am using your code .I can login into twitter but whenver im posting any tweet it saying tweet post is failed plz help..I am using android 2.2 google API

  3. Swathi says:

    can some one post the full code of this?

  4. Swathi says:

    can some one post full code of this?

  5. sri says:

    hey lorenze

    some fatal expression is showing up and i cant figure it out can u help me with that

  6. John Nogueira says:

    Just in case anyone wanted to know how to clear the user’s credentials from the Twitter webview… (In addition to clearing the access token from the app’s shared preferences, this modification forces the user to re-enter their username and password on the Twitter webview when signing back-on).

    1. In twitterapp.java, replace resetAccessToken function with this:

    public void resetAccessToken(Context context) {
    if (mAccessToken != null) {
    mSession.resetAccessToken();

    //clear webview cookies (in case user saved credentials on Twitter webview)
    CookieSyncManager.createInstance(context);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();

    mAccessToken = null;
    }
    }

    2. From main activity, call:

    mTwitter.resetAccessToken(this);

    • krishna kanth says:

      THANK U VERY MUCH FOR YOUR POST … i AM TRYING TO RELOGIN INTO TWIITTER FROM 6 MONTHS ………… BUT WHOMEVER I ASK THEY JUST SAY ONE SIMPLE THING IN TWITTER THERE IS SINGLE SIGN IN ON SO U CANNOT RELOGIN AGAIN AND ALSO ONCE YOU HAVE LOGGED IN YOU CANNOT LOGOUT. But u proved that they are wrong and thank u very very much for your post… It helped a department in a very big way … thank u very much … :)

  7. Upendra says:

    I got Exception here…

    mTwitter = new TwitterApp(this, twitter_consumer_key,twitter_secret_key);

    The Exception is::::

    E/AndroidRuntime(318): java.lang.VerifyError: net.londatiga.android.TwitterApp

  8. ganesh says:

    hey lorenze,

    how to post image with tweet using twitter API without using twitpic. if u hav any demo or sample code then post me the link

    thnk you in advance

  9. krishna kanth says:

    Hello lorenze, thanks for your post. I am able to connect to twitter and post successfully. But when i deleted the connection and try to connect again it is not working. It is showing a blank white page and also it is not calling the onError method in TwDialogListener. Please tell me where it was going wrong?

  10. fjr619 says:

    i wanna ask something. i can connect to twitter. but when i logout and i want to login again, it just stuck in white page. so what must i do for fix that problem?i really need this app for study about twitter connection.thanks

  11. tarun says:

    thanks for this twitter example.. this is the only working example I found on google…

  12. André says:

    Thank you very much. How can I post a tweet without display/activity screen? Thanks

  13. Vijay says:

    When i am click on Submit it will display a Toast :: Review Post then after sometime another Toast display “Post To Twitter Failed.”.

    please Solve it…. please…. please….

  14. Mohamed ismail says:

    its very useful above code,work fine
    Thanks

  15. Can says:

    Hi, I need a help about that codes.

    I downloaded your project. It’s working properly. But I wanted to build my own app. I imported the jar files. There is no problem. Then I take your TwitterApp.java file, TwitterDialog.java file and TwitterSession.java files to my package. I’m trying to login to twitter when I click on a button. When I create the instance of TwitterApp I got a problem. It gives me error on this code;

    mTwitter = new TwitterApp(getApplicationContext(), twitter_consumer_key,
    twitter_secret_key);

    and then crashes the application.

    I couldn’t figure it out

  16. asp17 says:

    hi,

    I downloaded your project. It gives me error on this code;

    mTwitter = new TwitterApp(getApplicationContext(), twitter_consumer_key,twitter_secret_key);

    and then crashes the application.

    plz help me.

  17. Rubyd says:

    I downloaded this code. But it gives me Error …. :’(

    mTwitter = new TwitterApp(this, twitter_consumer_key,twitter_secret_key);The Exception is::::
    java.lang.VerifyError: net.londatiga.android.TwitterApp

    ———————————–
    Pls solve this,

    • Ramesh Annadurai says:

      Hi Rubyd,

      1) Remove the libraries from the standard Java build path :

      Right click on the project name > Properties > Java Build Path > tab Libraries > remove everything except the “Android X.X” (2.3.3 in my case) and the “Android Dependencies”

      2) Copy the jar files into libs folder :

      a. Create “libs” folder in your project directory without double quotes.

      b. Copy all the required jar files and paste in libs folder.

      c. clean the project.

      By doing that, all the libraries in the folder “libs” are found by the Android plugin and are added to the “Android Dependencies” item of the project

      Thanks,
      RAMESH ANNADURAI

      • lorenz says:

        Hi Ramesh, thanks for that trick..thats the right way to solve the problem. ;)

        • Talal Qaboos says:

          i have same problem that RubyD have.. i have also try the way Ramesh told to make a libs folder and paste all jar packages into it. but error is same on mTwitter on create(Bundle). in TestConnect class.. my logs are
          06-03 19:18:12.774: E/AndroidRuntime(18667): FATAL EXCEPTION: main
          06-03 19:18:12.774: E/AndroidRuntime(18667): java.lang.VerifyError: net.londatiga.android.TwitterApp
          06-03 19:18:12.774: E/AndroidRuntime(18667): at net.londatiga.android.TestConnect.onCreate(TestConnect.java:52)
          06-03 19:18:12.774: E/AndroidRuntime(18667): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1065)

          please help me pleaseeeeeeee :( :’(

  18. [...] to Facebook wall from an Android application. I have written similar tutorial for Twitter to show how to post status to Twitter from Android and for Foursquare to show how to connect and use Foursquare API on [...]

  19. [...] to Facebook wall from an Android application. I have written similar tutorial for Twitter to show how to post status to Twitter from Android and for Foursquare to show how to connect and use Foursquare API on [...]

  20. joseph says:

    Hi,

    I downloaded your application and just modified the twitter_consumer_key and twitter_secret_key and set it to my app key. Im using android 2.3.3. Looks like its not working perfectly.

    The problem is the app unable to connect to twitter.

    This are the logs:

    08-14 18:02:46.613: D/TwitterApp(3830): Failed to get request token
    08-14 18:02:46.613: W/System.err(3830): oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: http://twitter.com/oauth/request_token
    08-14 18:02:46.613: W/System.err(3830): at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)
    08-14 18:02:46.613: W/System.err(3830): at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:69)
    08-14 18:02:46.613: W/System.err(3830): at net.londatiga.android.TwitterApp$2.run(TwitterApp.java:117)
    08-14 18:02:46.613: W/System.err(3830): Caused by: java.io.FileNotFoundException: http://twitter.com/oauth/request_token
    08-14 18:02:46.613: W/System.err(3830): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521)
    08-14 18:02:46.613: W/System.err(3830): at oauth.signpost.basic.HttpURLConnectionResponseAdapter.getContent(HttpURLConnectionResponseAdapter.java:18)
    08-14 18:02:46.623: W/System.err(3830): at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:228)
    08-14 18:02:46.623: W/System.err(3830): at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:189)
    08-14 18:02:46.623: W/System.err(3830): … 2 more

    Any sugestion and comments are very much appreciated.
    Thanks in advance.

  21. Yahya says:

    I’ve set:

    REQUEST_TOKEN = “https://api.twitter.com/oauth/request_token”;
    ACCESS_TOKEN = “https://api.twitter.com/oauth/access_token”;
    AUTHORIZE = “https://api.twitter.com/oauth/authorize”;

    and now it works… But i have a problem with CALLBACK_URL… I’ve set it to None when i create twitter app and now it’s not returning token to app, just require user to get pin code into app, and stuck there… What should i do? How should the CALLBACK_URL be?

    Thanks in advance…

  22. Boon says:

    hi,i get this when i postToTwitter :-

    TwitterException{exceptionCode=[15bb6564-00e4d61f], statusCode=401, retryAfter=0, rateLimitStatus=null, version=2.1.5-SNAPSHOT(build: d372a51b9b419cbd73d416474f4a855f3e889507)}

  23. Murali says:

    Hi,

    When i logout to current user and try to login to another user am getting login filed.Am also clearing cookiemanager.am getting following errors.

    08-30 16:20:04.344: W/System.err(1846): java.lang.IllegalStateException: consumer key/secret pair already set.
    08-30 16:20:04.344: W/System.err(1846): at twitter4j.TwitterOAuthSupportBaseImpl.setOAuthConsumer(TwitterOAuthSupportBaseImpl.java:234)
    08-30 16:20:04.344: W/System.err(1846): at twitter4j.Twitter.setOAuthConsumer(Twitter.java:54)
    08-30 16:20:04.353: W/System.err(1846): at net.londatiga.android.TwitterApp.configureToken(TwitterApp.java:78)
    08-30 16:20:04.353: W/System.err(1846): at net.londatiga.android.TwitterApp.access$7(TwitterApp.java:76)
    08-30 16:20:04.353: W/System.err(1846): at net.londatiga.android.TwitterApp$3.run(TwitterApp.java:158)

    help me thanks in advance.

    • Dejan says:

      I managed to make it work by re-initializing instance, like this..

      mTwitter.resetAccessToken(this);
      mTwitter = new TwitterApp(this, consumerKey,consumerSecret);
      mTwitter.setListener(mTwLoginDialogListener);
      mTwitter.authorize();

      not sure if this is the right way, but works for me :)

  24. stephen says:

    Hi Lorenz,
    I installed your app in my android galaxy y.version 2.3.3.every authorization is done perfectly .when i post a tweet.i m getting a toast that the tweet is posted..but when i check my twitter account..there is no tweet could u help me out

  25. fjr619 says:

    will you update your code when Twitter API upgrade to 1.1 ? because many change on new API

  26. stephen says:

    i used the above code with the jar files attached to it…if i m to use the latest upgraded version of the above jar files i m getting error in the source code..so i used the jar files attached below..works fine.but not able to post on wall..got the toast saying the tweet has been posted..

  27. Maykec says:

    Would i please you for source code (api 1.1) to?

    tnx :)

  28. fjr619 says:

    i want ask with your code, will access token be expired although user has been login and not logout?and if yes, how to make access token again without login again.

  29. Grayson says:

    Hi I’m having a problem connecting to twitter (program starts up in my eclipse emulator and when I click on “Twitter (not connected)” and it tries to connect it comes back with “Twitter Connection Failed”)(the emulator does have an internet connection). I’ve set the twitter_consumer_key and twitter_secret_key in both TestPost.java and TestConnect.java with my own. Other than that I have not changed or added anything else to the code (gotten from github).
    Is there anything else I need to set in the code to connect to Twitter. I would assume there would need to be some sort of username and password, though if it connects to twitter then I would assume Twitter would handle that instead of your code.

  30. iiwak says:

    - WARNING: Application does not specify an API level requirement!
    - Device API version is 10 (Android 2.3.7)

    What should I do?
    I use debuging usb connection.
    I debug your facebook connection code before. It work correctly. But I got error on your twitter connection code.
    Help me please.

    • iiwak says:

      I try to resolve my problem. I think “TwitterApp.java” not work correctly. I’ll got error when execute “TwitterApp.java”
      Help me, Lorenz.
      :)

  31. rushabh says:

    I am getting “Twitter connection failed” error while executing this function:

    mTwitter.authorize();

    in simulator as well as in device i am getting this error. i have all config jar files and also keys.

  32. ningning says:

    Excuse me: how to release the twitter with image?For twitter API 1.1, your code is still valid?

  33. rose says:

    我英语不好,直接用汉语表达吧!在android app怎么发布带有图片的状态(推文)呢?

  34. minal says:

    private TwitterApp mTwitter;
    I got error on that…what can i do???

  35. suresh k r says:

    I had done all the steps which stated above but wen i click connect it shows that twitter connection failed.. can anyone help me out wat mistake i had done…

  36. nita says:

    Someone help me please :(
    I’m very new to android, and still learning how to develop an android program.

    I did exactly these steps, but in the end my program is unexpectedly force closed.

    When I checked on the LogCat it show like this:

    11-10 17:15:40.987: E/AndroidRuntime(463): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.os.Handler.dispatchMessage(Handler.java:99)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.os.Looper.loop(Looper.java:123)
    11-10 17:15:40.987: E/AndroidRuntime(463): at android.app.ActivityThread.main(ActivityThread.java:3683)
    11-10 17:15:40.987: E/AndroidRuntime(463): at java.lang.reflect.Method.invokeNative(Native Method)
    11-10 17:15:40.987: E/AndroidRuntime(463): at java.lang.reflect.Method.invoke(Method.java:507)
    11-10 17:15:40.987: E/AndroidRuntime(463): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    11-10 17:15:40.987: E/AndroidRuntime(463): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    11-10 17:15:40.987: E/AndroidRuntime(463): at dalvik.system.NativeStart.main(Native Method)

    Does anyone know what is the problem?

    Thanks before~

  37. [...] following a tutorial in this link http://www.londatiga.net/it/how-to-post-twitter-status-from-android/ but I can’t import the “TwitterApp” even if I already import the [...]

  38. [...] following a tutorial in this link http://www.londatiga.net/it/how-to-post-twitter-status-from-android/ but I can’t import the “TwitterApp” even if I already import the [...]

  39. Emerald214 says:

    Could you give an update for Twitter API 1.1 and Twitter4J 3.0?

  40. androidvideo says:

    Wonderful blog! I found it while searching on Yahoo
    News. Do you have any suggestions on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there! Cheers

  41. Arun Jose says:

    The app fails to log in!
    Toast showing: Twitter connection failed.
    Changed the keys, updated the links….
    what do you think?

  42. Emerald214 says:

    Coul you post an update for Twitter API 1.1? What must I do to migrate from 1.0 to 1.1?

  43. venkat says:

    thank you for your blog.I used your code and starting a am getting force close.This is the error displayed in logcat:java.lang.VerifyError: net.londatiga.android.TwitterApp.Please help me,I dont know why I am getting this error.

  44. Felipe says:

    Thanks, it’s working fine

  45. Krish says:

    hai i tried this code…i replaced my secret key and consumer key for this code..no errors but wen i run this in emulator always its giving twitter connection failed..i could not solve this problem…please solve this…thanks in advance..
    Lorenz…

  46. Krish says:

    Hey i made the auth urls as https://…its logged in..but during posting it says post failed..plz guide me…
    thanks in advance..

  47. Krish says:

    hey i solved it..i forgot to give secret key and consumer key in TestPost.java…
    But why we need again in in this java file…any way we authenticated in TestConnect.java file..
    Thanks Lorenz..

  48. ynmly says:

    thanks for yourr blog….i have tried both facebook and twitter..facebook one running excellent…but i am facing problem in twitter..it give an error of :-

    [2013-04-03 16:51:48 - Dex Loader] Unable to execute dex: Multiple dex files define Ltwitter4j/TwitterBase;
    [2013-04-03 16:51:48 - AndroidTwitter-master] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Ltwitter4j/TwitterBase;
    [2013-04-03 17:35:19 - Dex Loader] Unable to execute dex: Multiple dex files define Ltwitter4j/TwitterBase;
    [2013-04-03 17:35:19 - AndroidTwitter-master] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Ltwitter4j/TwitterBase;

    could you plz plz me
    thanks lorenz..

Leave a Reply

 
bottom