Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Display public Twitter timeline using OAuth and Twitter4J
    primarykey
    data
    text
    <p>So I'm trying to get a list of status objects from a public Twitter timeline ( not my own Twitter timeline or anything that I have admin access to, just a public one from a local organization ) using the Twitter4J library in Android Studio, but I'm getting a little confused by the documentation. I'm running into this error: "Invalid access token format."</p> <p>I did create a developers account with Twitter and got a consumer key and token, as well as an access token and secret numbers. Those values are saved in a set of private static strings for now. TWITTER_ZOO_ID is a private long with the Twitter ID number for the feed that I want to display. Here's the applicable code that I currently have:</p> <pre><code> Twitter twitter; List&lt;Status&gt; statuses = null; ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey( TWITTER_CONSUMER_KEY ) .setOAuthConsumerSecret( TWITTER_CONSUMER_SECRET ) .setOAuthAccessToken( TWITTER_AUTH_TOKEN ) .setOAuthAccessTokenSecret( TWITTER_AUTH_TOKEN_SECRET ); try { TwitterFactory tf = new TwitterFactory(cb.build()); twitter = tf.getInstance(); twitter.setOAuthConsumer( TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET ); statuses = twitter.getUserTimeline( TWITTER_ZOO_ID ); } catch( TwitterException e ) { Log.e( "TwitterListFragment", "Twitter Exception" ); return; } for( Status status : statuses ) mAdapter.add( status ); </code></pre> <p>If anyone has a link to a good example for Twitter 1.1 using Twitter4J, or can provide an example of how to get those statuses, I'd really appreciate it. I'm currently using Android Studio and including Twitter4J in Gradle from MavenCentral.</p> <p>Thank you!</p> <p>EDIT:</p> <p>Upon further reading, I've added this additional code without success: </p> <pre><code>twitter.setOAuthConsumer( TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET ); AccessToken token = new AccessToken( TWITTER_AUTH_TOKEN, TWITTER_AUTH_TOKEN_SECRET ); twitter.setOAuthAccessToken( token ); </code></pre>
    singulars
    1. This table or related slice is empty.
    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. 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