[Android] Fix NPE

Geoffrey Métais git at videolan.org
Thu Nov 12 11:48:57 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 12 11:14:39 2015 +0100| [84913eeb2ecfd15a9af046081f344ad92f426cba] | committer: Geoffrey Métais

Fix NPE

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=84913eeb2ecfd15a9af046081f344ad92f426cba
---

 vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java      |    5 +++--
 vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java |    2 +-
 vlc-android/src/org/videolan/vlc/util/Util.java                |    1 -
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
index 9628f57..f225e23 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
@@ -27,6 +27,7 @@ import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.res.TypedArray;
 import android.preference.PreferenceManager;
+import android.support.annotation.NonNull;
 import android.support.design.widget.Snackbar;
 import android.text.TextUtils;
 import android.util.DisplayMetrics;
@@ -43,12 +44,12 @@ public class UiTools {
     private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);
 
     /** Print an on-screen message to alert the user */
-    public static void snacker(View view, int stringId) {
+    public static void snacker(@NonNull View view, @NonNull int stringId) {
         Snackbar.make(view, stringId, Snackbar.LENGTH_SHORT).show();
     }
 
     /** Print an on-screen message to alert the user */
-    public static void snacker(View view, String message) {
+    public static void snacker(@NonNull View view, @NonNull String message) {
         Snackbar.make(view, message, Snackbar.LENGTH_SHORT).show();
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java b/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java
index 043fd06..5915876 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/Advanced.java
@@ -120,7 +120,7 @@ public class Advanced extends BasePreferenceFragment implements SharedPreference
         setLocalePref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
             @Override
             public boolean onPreferenceChange(Preference preference, Object newValue) {
-                UiTools.snacker(getView().findViewById(android.R.id.content), R.string.set_locale_popup);
+                UiTools.snacker(getView(), R.string.set_locale_popup);
                 return true;
             }
         });
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 90e7945..e5a0464 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -31,7 +31,6 @@ import org.videolan.vlc.VLCApplication;
 
 import java.io.BufferedReader;
 import java.io.Closeable;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;



More information about the Android mailing list