![]() ![]() weatherRV.findViewHolderForAdapterPosition(tile.getSavedPosition()) ![]() Note : I also tried doing this with an instance of the RecyclerView from theĪctivity class with the same issues. I pass an instance of the RecyclerView to the adapter and from there use : ![]() Once the information is ready to be updated it works with no problems. This only happens after the dummy tile gets added. I am guessing because they have different amount of memory? or screen sizes? Therefore, the ViewHolder pool is larger or smaller. However 7 or more and its kept saying that the itemView (for the respective tile) is null.ĭifferent phones give different numbers, for example on a Samsung Note 5 it lets you add 9 tiles and from then on it gives null pointer exception. Meaning the first 6 I added gave no errors. I was then able to get an instance of the correct itemView for exactly 6 of them. I added an addOnLayoutChangeListener to the RecyclerView. User adds a city to get the wheather from ->Ī dummy tile gets added to the RecyclerView.Adapter -> loading animation is made visibleĪt the same time in a different thread -> information is downloaded from an api -> dummy tile is updated with information -> loading animation is made invisible.Īt first when adding a dummy tile making the loading animation visible on the dummy tile would give a null pointer exception because the tile would not be added fast enough. While the weather information is being downloaded I wish to show a loading icon on a per tile basis. Each view is a tile that contains weather information. I have a RecyclerView which is using a GridManagerLayout.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |