title: Log in with twitter4j callback
body: <p>I try to write an application where an user can log in on twitter. I use twitter4j like library.My problem is that when I go in the page where I must put username and password, the program block because i don't know use callback to came in my application. Someone can me help?</p>
  
  <p>public class MainActivity extends Activity {</p>
  
  <pre><code>private Twitter twitter;
  RequestToken requestToken;
  final public static String CALLBACK_SCHEME = "x-latify-oauth-twitter";
  final public static String CALLBACK_URL = CALLBACK_SCHEME + "://callback";
  private Uri uri;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Button b = (Button) findViewById(R.id.button1);
      b.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              new updateTwitterStatus().execute();
  
          }
      });
  
  }
  
  @Override
  protected void onDestroy() {
  
      twitter.shutdown();
  }
  
  class updateTwitterStatus extends AsyncTask&lt;Void, Void, String&gt; {
  
      @Override
      protected String doInBackground(Void... params) {
          String testStatus = "prova tweet ";
  
          ConfigurationBuilder cb = new ConfigurationBuilder();
  
          // the following is set without accesstoken- desktop client
          cb.setDebugEnabled(true)
                  .setOAuthConsumerKey("******")
                  .setOAuthConsumerSecret(
                          "*****");
  
          try {
              TwitterFactory tf = new TwitterFactory(cb.build());
              twitter = tf.getInstance();
              Log.i("bauu", "miao");
  
              requestToken = twitter.getOAuthRequestToken();
              String authUrl = requestToken.getAuthenticationURL();
              startActivity(new Intent(Intent.ACTION_VIEW,
                      Uri.parse(requestToken.getAuthenticationURL())));
              uri = Uri.parse(requestToken.getAuthenticationURL());
  
              return authUrl;
  
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
  
      @Override
      protected void onPostExecute(String s) {
  
          startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(s)));    
      }
  
  }
  </code></pre>