Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have solved by changing <code>OAuthTask</code> class... The problem was the permission only... Put <code>Permission.WRITE</code> instead of <code>Permission.READ</code></p> <pre><code>public class OAuthTask extends AsyncTask&lt;Void, Integer, String&gt; { // private static final Logger logger = LoggerFactory // .getLogger(OAuthTask.class); private static final Uri OAUTH_CALLBACK_URI = Uri .parse(FlickrjAndroidSampleActivity.CALLBACK_SCHEME + "://oauth"); //$NON-NLS-1$ /** * The context. */ private Context mContext; /** * The progress dialog before going to the browser. */ private ProgressDialog mProgressDialog; /** * Constructor. * * @param context */ public OAuthTask(Context context) { super(); this.mContext = context; } @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = ProgressDialog.show(mContext, "", "Generating the authorization request..."); //$NON-NLS-1$ //$NON-NLS-2$ mProgressDialog.setCanceledOnTouchOutside(true); mProgressDialog.setCancelable(true); mProgressDialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dlg) { OAuthTask.this.cancel(true); } }); } /* * (non-Javadoc) * * @see android.os.AsyncTask#doInBackground(Params[]) */ @Override protected String doInBackground(Void... params) { try { Flickr f = FlickrHelper.getInstance().getFlickr(); OAuthToken oauthToken = f.getOAuthInterface().getRequestToken( OAUTH_CALLBACK_URI.toString()); saveTokenSecrent(oauthToken.getOauthTokenSecret()); URL oauthUrl = f.getOAuthInterface().buildAuthenticationUrl( Permission.WRITE, oauthToken); return oauthUrl.toString(); } catch (Exception e) { // logger.error("Error to oauth", e); //$NON-NLS-1$ return "error:" + e.getMessage(); //$NON-NLS-1$ } } /** * Saves the oauth token secrent. * * @param tokenSecret */ private void saveTokenSecrent(String tokenSecret) { // logger.debug("request token: " + tokenSecret); //$NON-NLS-1$ FlickrjAndroidSampleActivity act = (FlickrjAndroidSampleActivity) mContext; act.saveOAuthToken(null, null, null, tokenSecret); // logger.debug("oauth token secret saved: {}", tokenSecret); //$NON-NLS-1$ } @Override protected void onPostExecute(String result) { if (mProgressDialog != null) { mProgressDialog.dismiss(); } if (result != null &amp;&amp; !result.startsWith("error")) { //$NON-NLS-1$ mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri .parse(result))); } else { Toast.makeText(mContext, result, Toast.LENGTH_LONG).show(); } } } </code></pre> <p>see <a href="https://github.com/luminousman/Flickr" rel="nofollow noreferrer"><strong>Full Demo</strong></a></p> <p><img src="https://i.stack.imgur.com/oKsMq.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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