From 931f34d2fd126d5c71528494ffb013fb80bac13b Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Mon, 26 Sep 2016 18:01:39 +0200 Subject: [PATCH] fixed related videos nullpointer exception --- .../newpipe/detail/VideoItemDetailFragment.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java index 3709ebe39..626c52ba3 100644 --- a/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java @@ -145,12 +145,8 @@ public class VideoItemDetailFragment extends Fragment { progressBar.setVisibility(View.GONE); if(info.next_video != null) { - infoItemBuilder.setOnItemSelectedListener(new InfoItemBuilder.OnItemSelectedListener() { - @Override - public void selected(String url) { - openStreamUrl(url); - } - }); + // todo: activate this function or remove it + nextStreamView.setVisibility(View.GONE); } else { nextStreamView.setVisibility(View.GONE); activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE); @@ -522,6 +518,12 @@ public class VideoItemDetailFragment extends Fragment { for (final StreamPreviewInfo item : info.related_streams) { similarLayout.addView(infoItemBuilder.buildView(similarLayout, item)); } + infoItemBuilder.setOnItemSelectedListener(new InfoItemBuilder.OnItemSelectedListener() { + @Override + public void selected(String url) { + openStreamUrl(url); + } + }); } private void onErrorBlockedByGema() {