daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     /**
  3.      * Get an array with file names of all category images in drawable folder.
  4.      *
  5.      * @return the file names of all catergories in drawable folder.
  6.      */
  7.     public String[] getCategoryDrawables() {
  8.         Field[] fields = R.drawable.class.getFields();
  9.         String[] categoryDrawables = new String[fields.length];
  10.  
  11.         // Place all category images in the array.
  12.         for (int i = 0; i < categoryDrawables.length; i++) {
  13.  
  14.             // Iterate through NoteCategories and get the drawables that matches
  15.             // the category names.
  16.             for (NoteCategory category : NoteCategory.values()) {
  17.                 if (category.toString().equals(categoryDrawables[i])) {
  18.                     categoryDrawables[i] = fields[i].getName();
  19.                 }
  20.             }
  21.         }
  22.  
  23.         return categoryDrawables;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top