List of usage examples for twitter4j.conf Configuration getOAuthAccessTokenURL
String getOAuthAccessTokenURL();
From source file:com.nookdevs.twook.activities.SettingsActivity.java
License:Open Source License
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set the title at the top of the eink screen final Resources res = getResources(); NAME = res.getText(R.string.app_name).toString() + res.getText(R.string.title_separator).toString() + res.getText(R.string.settings_title).toString(); setContentView(R.layout.settings);/* ww w . j a va 2 s .co m*/ final InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); // get the buttons txtPin = (EditText) findViewById(R.id.pin); // set listeners txtPin.setOnKeyListener(credentialsListener); WebView engine = (WebView) findViewById(R.id.web_frame); engine.setOnKeyListener(credentialsListener); // the submit is done through jscript, so we'd better allow it... engine.getSettings().setJavaScriptEnabled(true); // set credentials from Settings Settings settings = Settings.getSettings(this); ConfigurationBuilder confBuilder = settings.getConfiguration(); // this doesn't seem to be used by the authorization object... // confBuilder.setUser(username); // confBuilder.setPassword(password); Configuration conf = confBuilder.build(); mAuth = new OAuthAuthorization(conf); TextView validation = (TextView) findViewById(R.id.validation); try { // ask for the request token first, so we can ask the user for // authorization RequestToken requestToken = mAuth.getOAuthRequestToken(); Log.d(TAG, "Request token: " + requestToken.toString()); // this includes the oauth_token parameter and everything Log.d(TAG, "Sending user to " + requestToken.getAuthorizationURL()); engine.loadUrl(requestToken.getAuthorizationURL()); /* * Intent myIntent = new Intent(Intent.ACTION_VIEW, * Uri.parse(requestToken.getAuthorizationURL())); * startActivity(myIntent); */ Log.d(TAG, "Will authorize to " + conf.getOAuthAccessTokenURL()); } catch (TwitterException excep) { // TODO: better validation here validation.setText("Unknown error: " + excep.getMessage()); } // spiner for selecting refresh times // Spinner refresh = (Spinner) findViewById(R.id.refresh_time); // ArrayAdapter adapter = ArrayAdapter.createFromResource( // this, R.array.refresh_times, android.R.layout.simple_spinner_item); // adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // refresh.setAdapter(adapter); }