OSDN Git Service

Eleven: Fix a crash when clicking the fragment header caused by the section headers
[android-x86/packages-apps-Eleven.git] / src / com / cyngn / eleven / adapters / ArtistAdapter.java
index 11e24d8..e861279 100644 (file)
@@ -218,6 +218,22 @@ public class ArtistAdapter extends ArrayAdapter<Artist> implements SectionAdapte
     }
 
     /**
+     * Gets the item position for a given id
+     * @param id identifies the object
+     * @return the position if found, -1 otherwise
+     */
+    @Override
+    public int getItemPosition(long id) {
+        for (int i = 0; i < getCount(); i++) {
+            if (getItem(i).mArtistId == id) {
+                return i;
+            }
+        }
+
+        return  -1;
+    }
+
+    /**
      * @param extra True to load line three and the background image, false
      *            otherwise.
      */