From 123271c223d9e038b848cbbdaec79a92cf5d13ba Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sat, 1 Feb 2014 20:08:28 -0800 Subject: Use native unique id generator on 4.2+ --- src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index e8ae6f1e..07aed372 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -28,6 +28,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.media.MediaMetadataRetriever; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; @@ -361,6 +362,10 @@ public class SubsonicFragment extends Fragment { } protected int getNewId() { + if(rootView != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + return rootView.generateViewId(); + } + for (;;) { final int result = nextGeneratedId.get(); // aapt-generated IDs have the high byte nonzero; clamp to the range under that. -- cgit v1.2.3