Steps to do before:

  1. Register for your Twitter App at here.
  2. On your dashboard, Create new App and enter details for your app and don’t forget to give some dummy url in the callback url field.
    twitter new app
  3. Under the permission tab change the access type to Read and Write.
    twitter permission
  4. Under the Keys & Access tab, Copy Consumer Key & Consumer Secret key which are required in your application.
    twitter keys
  5. In this Tutorial we’ll be using twitter4j sdk, download sdk from here and extract and copy the core jar file to your libs folder. Now on Android Studio use compile files('libs/twitter4j-core-4.0.4.jar')


Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> layout ->Create new xml, auth_dialog.xml and add following code :

Step 4 : Open src -> package -> and add following code :

Step 5 : Open src -> package -> Create new class, and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :


 twitter twitter_logintwitter_home  twitter_new_tweet


Download SourceCode