private SlideDeck getSlideDeckSync() { try { return slideDeckFutureTask.get(); } catch (InterruptedException e) { Log.w(TAG, e); return null; } catch (ExecutionException e) { Log.w(TAG, e); return null; } }
public void fetchMediaSlide(final FutureTaskListener<Slide> listener) { slideDeckFutureTask.addListener( new FutureTaskListener<SlideDeck>() { @Override public void onSuccess(SlideDeck deck) { for (Slide slide : deck.getSlides()) { if (slide.hasImage() || slide.hasVideo() || slide.hasAudio()) { listener.onSuccess(slide); return; } } listener.onFailure(new MediaNotFoundException("no media slide found")); } @Override public void onFailure(Throwable error) { listener.onFailure(error); } }); }