Как вывести все изображение из папки drawable? Долго гуглил и искал, единственное решение которое нашел тут:
final R.drawable drawableResources = new R.drawable();
final Class<R.drawable> c = R.drawable.class;
final Field[] fields = c.getDeclaredFields();
for (int i = 0, max = fields.length; i < max; i++) {
final int resourceId;
try {
resourceId = fields[i].getInt(drawableResources);
showLog(i + ". R.drawable." + fields[i].getName());
} catch (Exception e) {
continue;
}
/* make use of resourceId for accessing Drawables here */
}
Но тут не понимаю откуда появляются много изображений (в папке всего около 50 изображений), но в логе когда смотрю их очень много, и таких изображений у меня в папке нет, в чем проблема?
Вот лог:
03-05 20:24:08.536 24559-24559/ru.by_em.my_finances D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
03-05 20:24:08.611 24559-24559/ru.by_em.my_finances I/Timeline: Timeline: Activity_launch_request id:ru.by_em.my_finances time:19498911
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 2. R.drawable.abc_ab_share_pack_mtrl_alpha
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 3. R.drawable.abc_action_bar_item_background_material
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 4. R.drawable.abc_btn_borderless_material
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 5. R.drawable.abc_btn_check_material
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 6. R.drawable.abc_btn_check_to_on_mtrl_000
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 7. R.drawable.abc_btn_check_to_on_mtrl_015
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 8. R.drawable.abc_btn_colored_material
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 9. R.drawable.abc_btn_default_mtrl_shape
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 10. R.drawable.abc_btn_radio_material
03-05 20:24:08.666 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 11. R.drawable.abc_btn_radio_to_on_mtrl_000
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 12. R.drawable.abc_btn_radio_to_on_mtrl_015
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 13. R.drawable.abc_btn_switch_to_on_mtrl_00001
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 14. R.drawable.abc_btn_switch_to_on_mtrl_00012
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 15. R.drawable.abc_cab_background_internal_bg
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 16. R.drawable.abc_cab_background_top_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 17. R.drawable.abc_cab_background_top_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 18. R.drawable.abc_control_background_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 19. R.drawable.abc_dialog_material_background
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 20. R.drawable.abc_edit_text_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 21. R.drawable.abc_ic_ab_back_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 22. R.drawable.abc_ic_arrow_drop_right_black_24dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 23. R.drawable.abc_ic_clear_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 24. R.drawable.abc_ic_commit_search_api_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 25. R.drawable.abc_ic_go_search_api_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 26. R.drawable.abc_ic_menu_copy_mtrl_am_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 27. R.drawable.abc_ic_menu_cut_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 28. R.drawable.abc_ic_menu_overflow_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 29. R.drawable.abc_ic_menu_paste_mtrl_am_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 30. R.drawable.abc_ic_menu_selectall_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 31. R.drawable.abc_ic_menu_share_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 32. R.drawable.abc_ic_search_api_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 33. R.drawable.abc_ic_star_black_16dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 34. R.drawable.abc_ic_star_black_36dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 35. R.drawable.abc_ic_star_black_48dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 36. R.drawable.abc_ic_star_half_black_16dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 37. R.drawable.abc_ic_star_half_black_36dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 38. R.drawable.abc_ic_star_half_black_48dp
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 39. R.drawable.abc_ic_voice_search_api_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 40. R.drawable.abc_item_background_holo_dark
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 41. R.drawable.abc_item_background_holo_light
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 42. R.drawable.abc_list_divider_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 43. R.drawable.abc_list_focused_holo
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 44. R.drawable.abc_list_longpressed_holo
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 45. R.drawable.abc_list_pressed_holo_dark
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 46. R.drawable.abc_list_pressed_holo_light
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 47. R.drawable.abc_list_selector_background_transition_holo_dark
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 48. R.drawable.abc_list_selector_background_transition_holo_light
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 49. R.drawable.abc_list_selector_disabled_holo_dark
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 50. R.drawable.abc_list_selector_disabled_holo_light
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 51. R.drawable.abc_list_selector_holo_dark
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 52. R.drawable.abc_list_selector_holo_light
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 53. R.drawable.abc_menu_hardkey_panel_mtrl_mult
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 54. R.drawable.abc_popup_background_mtrl_mult
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 55. R.drawable.abc_ratingbar_indicator_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 56. R.drawable.abc_ratingbar_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 57. R.drawable.abc_ratingbar_small_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 58. R.drawable.abc_scrubber_control_off_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 59. R.drawable.abc_scrubber_control_to_pressed_mtrl_000
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 60. R.drawable.abc_scrubber_control_to_pressed_mtrl_005
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 61. R.drawable.abc_scrubber_primary_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 62. R.drawable.abc_scrubber_track_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 63. R.drawable.abc_seekbar_thumb_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 64. R.drawable.abc_seekbar_tick_mark_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 65. R.drawable.abc_seekbar_track_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 66. R.drawable.abc_spinner_mtrl_am_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 67. R.drawable.abc_spinner_textfield_background_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 68. R.drawable.abc_switch_thumb_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 69. R.drawable.abc_switch_track_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 70. R.drawable.abc_tab_indicator_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 71. R.drawable.abc_tab_indicator_mtrl_alpha
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 72. R.drawable.abc_text_cursor_material
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 73. R.drawable.abc_text_select_handle_left_mtrl_dark
03-05 20:24:08.671 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 74. R.drawable.abc_text_select_handle_left_mtrl_light
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 75. R.drawable.abc_text_select_handle_middle_mtrl_dark
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 76. R.drawable.abc_text_select_handle_middle_mtrl_light
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 77. R.drawable.abc_text_select_handle_right_mtrl_dark
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 78. R.drawable.abc_text_select_handle_right_mtrl_light
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 79. R.drawable.abc_textfield_activated_mtrl_alpha
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 80. R.drawable.abc_textfield_default_mtrl_alpha
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 81. R.drawable.abc_textfield_search_activated_mtrl_alpha
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 82. R.drawable.abc_textfield_search_default_mtrl_alpha
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 83. R.drawable.abc_textfield_search_material
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 84. R.drawable.abc_vector_test
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 85. R.drawable.aperture
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 86. R.drawable.app
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 87. R.drawable.bag
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 88. R.drawable.bb_bottom_bar_top_shadow
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 89. R.drawable.bike
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 90. R.drawable.bookshelf
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 91. R.drawable.box
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 92. R.drawable.briefcase
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 93. R.drawable.calculator
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 94. R.drawable.camera
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 95. R.drawable.cart
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 96. R.drawable.clock
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 97. R.drawable.coin
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 98. R.drawable.computer
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 99. R.drawable.creditcard
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 100. R.drawable.design_fab_background
03-05 20:24:08.676 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 101. R.drawable.design_snackbar_background
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 102. R.drawable.diagram59
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 103. R.drawable.divider
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 104. R.drawable.easel
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 105. R.drawable.email
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 106. R.drawable.fashion
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 107. R.drawable.focus
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 108. R.drawable.food
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 109. R.drawable.gas
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 110. R.drawable.genius
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 111. R.drawable.globe
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 112. R.drawable.heart
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 113. R.drawable.home
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 114. R.drawable.ic_add_white_24dp
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 115. R.drawable.ic_backspace_black_18dp
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 116. R.drawable.ic_favorites
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 117. R.drawable.ic_friends
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 118. R.drawable.ic_map
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 119. R.drawable.ic_nearby
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 120. R.drawable.ic_recents
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 121. R.drawable.ic_restaurants
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 122. R.drawable.jumper
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 123. R.drawable.mail
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 124. R.drawable.mcv_action_next
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 125. R.drawable.mcv_action_previous
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 126. R.drawable.microphone
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 127. R.drawable.money
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 128. R.drawable.music
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 129. R.drawable.notification_action_background
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 130. R.drawable.notification_bg
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 131. R.drawable.notification_bg_low
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 132. R.drawable.notification_bg_low_normal
03-05 20:24:08.681 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 133. R.drawable.notification_bg_low_pressed
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 134. R.drawable.notification_bg_normal
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 135. R.drawable.notification_bg_normal_pressed
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 136. R.drawable.notification_icon_background
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 137. R.drawable.notification_template_icon_bg
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 138. R.drawable.notification_template_icon_low_bg
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 139. R.drawable.notification_tile_bg
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 140. R.drawable.notify_panel_notification_icon_bg
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 141. R.drawable.paintbrush2
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 142. R.drawable.phone
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 143. R.drawable.plane
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 144. R.drawable.polaroidcamera
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 145. R.drawable.present
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 146. R.drawable.repair
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 147. R.drawable.sailboat
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 148. R.drawable.schooolbus
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 149. R.drawable.side_nav_bar
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 150. R.drawable.skateboard
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 151. R.drawable.smartphone
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 152. R.drawable.star
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 153. R.drawable.steeringwheel
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 154. R.drawable.stock
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 155. R.drawable.taxi
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 156. R.drawable.tools
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 157. R.drawable.train
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 158. R.drawable.trophy
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 159. R.drawable.upload
03-05 20:24:08.686 24559-24559/ru.by_em.my_finances D/myLogs: ChangeIconActivity 160. R.drawable.weightlifting
Исправил ситуацию следующим образом, но не думаю, что это правильный вариант:
for (int i = 0, max = fields.length; i < max; i++) {
final int resourceId;
String name = fields[i].getName();
if (
!name.startsWith("abc_")
&& !name.startsWith("design_")
&& !name.startsWith("notification_")
&& !name.startsWith("select_dialog_")
&& !name.startsWith("support_")
&& !name.startsWith("ic_")
&& !name.startsWith("bb_")
&& !name.startsWith("mcv_")
&& !name.startsWith("notify_")
) {
try {
resourceId = fields[i].getInt(drawableResources);
categories.add(new Category("", resourceId));
showLog(i + ". R.drawable." + fields[i].getName());
} catch (Exception e) {
continue;
}
//make use of resourceId for accessing Drawables here
}
}
Как реализовать лучше?
Дело в том, что в ресурсах уже есть дефолтные drawable. Видимо, они и попадают к вам в массив.
Попробуйте использовать Assets. Создайте в папке assets каталог images и поместите туда изображения. Таким образом можно получить массив Drawable:
AssetManager am = context.getAssets();
String[] files = am.list("images");
InputStream istr = null;
ArrayList<Drawable> drawables = new ArrayList<>();
for (String file : files) {
Drawable d = Drawable.createFromStream(am.open(file), null);
drawables.add(d);
}
Пример взят отсюда.
Айфон мало держит заряд, разбираемся с проблемой вместе с AppLab
Перевод документов на английский язык: Важность и ключевые аспекты
Какие существуют виды рекламных бордов и как выбрать подходящий?
Недавно после установки Intellij Idea 20163
Двумерный массив состоит из String "X" и String "O"Я по нему пробегаюсь и ищу кол-во X и O