Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Find the below working code</p> <pre><code>public class LoginTask extends AsyncTask&lt;Void, Void, RequestToken&gt; { private ProgressDialog progressDialog; public LoginTask() { progressDialog = ProgressDialog.show(MainActivity.this, "", "Loading. Please wait...", false); } @Override protected RequestToken doInBackground(Void... params) { // TODO Auto-generated method stub ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY); builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET); Configuration configuration = builder.build(); TwitterFactory factory = new TwitterFactory(configuration); twitter = factory.getInstance(); try { return requestToken = twitter .getOAuthRequestToken(TWITTER_CALLBACK_URL); } catch (TwitterException e) { e.printStackTrace(); return null; } } @Override protected void onPreExecute() { // TODO Auto-generated method stub MainActivity.this.setProgressBarIndeterminateVisibility(true); } @Override protected void onPostExecute(RequestToken result) { // TODO Auto-generated method stub MainActivity.this.setProgressBarIndeterminateVisibility(false); progressDialog.dismiss(); try { requestToken = result; MainActivity.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri .parse(requestToken.getAuthenticationURL()))); } catch(Exception e) { e.printStackTrace(); alert.showAlertDialog(MainActivity.this, "Internet Connection Timeout Error", "Please try later.", false); } } } </code></pre> <p>Can you put your logcat error. So that it will easy to find why you are getting null pointer exception.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload