segadude

Untitled

May 5th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. public class HarvesterAsync extends AsyncTask <String, Void, String[]> {
  2.  
  3.  
  4.  
  5.     @Override
  6.     protected String[] doInBackground(String... params) {
  7.         String streamTitle = null;
  8.         String songTitle = null;
  9.         Scraper scraper = new ShoutCastScraper();
  10.         List<Stream> streams = null;
  11.         try {
  12.             streams = scraper.scrape(new URI(params[0]));
  13.         } catch (URISyntaxException e) {
  14.             e.printStackTrace();
  15.         } catch (ScrapeException e) {
  16.             e.printStackTrace();
  17.         }
  18.         for (Stream stream: streams) {
  19.             streamTitle = stream.getTitle();
  20.             songTitle = stream.getCurrentSong();
  21.         }
  22.         return new String[] {streamTitle, songTitle};
  23.     }
  24.  
  25.     @Override
  26.     protected void onPostExecute(String[] s) {
  27.         super.onPostExecute(s);
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment