mirror of
https://github.com/bspeice/itcs4180
synced 2024-12-04 13:18:16 -05:00
Twitter functionality now working for HW 5
This commit is contained in:
parent
5e5bfb04ec
commit
cd3233daaa
@ -6,7 +6,8 @@
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="12"
|
||||
android:targetSdkVersion="18" />
|
||||
android:targetSdkVersion="18" />
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -1,7 +1,10 @@
|
||||
package edu.uncc.itcs4180.hw5;
|
||||
|
||||
import edu.uncc.itcs4180.hw5.twitter.TweetList;
|
||||
import edu.uncc.itcs4180.hw5.twitter.TwitterClient;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
@ -1,6 +1,11 @@
|
||||
package edu.uncc.itcs4180.hw5.twitter;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class TwitterAuthentication {
|
||||
@SerializedName("token_type")
|
||||
String tokenType;
|
||||
|
||||
@SerializedName("access_token")
|
||||
String accessToken;
|
||||
}
|
||||
|
@ -5,11 +5,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.BreakIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
@ -22,11 +18,11 @@ import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Base64;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class TwitterClient {
|
||||
|
||||
private final String API_KEY = "HuEbvsXOxQsKVmTneyilVtsV6";
|
||||
@ -38,10 +34,9 @@ public class TwitterClient {
|
||||
// Code mimicked in large part from:
|
||||
// https://github.com/Rockncoder/TwitterTutorial/blob/master/src/com/example/TwitterTutorial/MainActivity.java
|
||||
|
||||
public static TweetList getTweetList(String handle) {
|
||||
TwitterClient tc = new TwitterClient();
|
||||
public TweetList getTweetList(String handle) {
|
||||
try {
|
||||
return tc.new TweetListDownloader().execute(handle).get();
|
||||
return new TweetListDownloader().execute(handle).get();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user