List of usage examples for twitter4j Twitter getSavedSearches
ResponseList<SavedSearch> getSavedSearches() throws TwitterException;
From source file:com.klinker.android.twitter.activities.drawer_activities.SavedSearchesActivity.java
License:Apache License
public static void getSearches() { new Thread(new Runnable() { @Override//from w w w . j a v a 2 s.c o m public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); final ResponseList<SavedSearch> searches = twitter.getSavedSearches(); Collections.sort(searches, new Comparator<SavedSearch>() { public int compare(SavedSearch result1, SavedSearch result2) { return result1.getQuery().compareTo(result2.getQuery()); } }); final ArrayList<String> searchNames = new ArrayList<String>(); for (SavedSearch sear : searches) { searchNames.add(sear.getQuery()); } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (searchNames.size() > 0) { adapter = new SavedSearchArrayAdapter(context, searchNames); listView.setAdapter(adapter); listView.setVisibility(View.VISIBLE); } else { try { nothing.setVisibility(View.VISIBLE); } catch (Exception e) { } listView.setVisibility(View.GONE); } spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { spinner.setVisibility(View.GONE); } }); } } }).start(); }
From source file:com.klinker.android.twitter.ui.drawer_activities.SavedSearchesActivity.java
License:Apache License
public static void getSearches() { new Thread(new Runnable() { @Override//from w w w.ja va 2s .com public void run() { try { Twitter twitter = Utils.getTwitter(context, settings); final ResponseList<SavedSearch> searches = twitter.getSavedSearches(); Collections.sort(searches, new Comparator<SavedSearch>() { public int compare(SavedSearch result1, SavedSearch result2) { return result1.getQuery().compareTo(result2.getQuery()); } }); final ArrayList<String> searchNames = new ArrayList<String>(); Log.v("talon_searches", "got saved searches"); for (SavedSearch sear : searches) { Log.v("talon_searches", sear.getName()); searchNames.add(sear.getQuery()); } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { if (searchNames.size() > 0) { adapter = new SavedSearchArrayAdapter(context, searchNames); listView.setAdapter(adapter); listView.setVisibility(View.VISIBLE); } else { try { nothing.setVisibility(View.VISIBLE); } catch (Exception e) { } listView.setVisibility(View.GONE); } spinner.setVisibility(View.GONE); } }); } catch (Exception e) { e.printStackTrace(); ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { spinner.setVisibility(View.GONE); } }); } } }).start(); }
From source file:com.mothsoft.integration.twitter.TwitterServiceImpl.java
License:Apache License
public List<SavedSearch> listSavedSearches() { try {//from www . ja va 2 s . com final Twitter twitter = factory.getInstance(); final List<SavedSearch> savedSearches = twitter.getSavedSearches(); return savedSearches; } catch (TwitterException e) { throw wrapException(e); } }
From source file:de.vanita5.twittnuker.loader.support.SavedSearchesLoader.java
License:Open Source License
@Override public ResponseList<SavedSearch> loadInBackground() { final Twitter twitter = getTwitterInstance(getContext(), mAccountId, false); if (twitter == null) return null; try {/*from w w w. jav a 2 s .c o m*/ return twitter.getSavedSearches(); } catch (final TwitterException e) { e.printStackTrace(); } return null; }
From source file:twitter4j.examples.savedsearches.GetSavedSearches.java
License:Apache License
/** * Usage: java twitter4j.examples.savedsearches.GetSavedSearches * * @param args message// w w w. j a v a2 s.co m */ public static void main(String[] args) { try { Twitter twitter = new TwitterFactory().getInstance(); List<SavedSearch> savedSearches = twitter.getSavedSearches(); for (SavedSearch savedSearch : savedSearches) { System.out.println("[name:" + savedSearch.getName() + " query:" + savedSearch.getQuery() + " id:" + savedSearch.getId() + "]"); } System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to retrieve saved searches: " + te.getMessage()); System.exit(-1); } }