

In content_scrolling.xml replace the TextView with: Now we need to add the fragment we created to our activity. We'll replace those with our picture items.įragment_item_list.xml - contains the RecyclerView widget.įragment_item.xml - layout of each item in the list. ItemFragment - The fragment that holds and initializes the adapter.ĭummy/Dumm圜ontent - Dummy items for populating the list. MyItemRecyclerViewAdapter - Creates the view holder which, well, holds the views for items in the list and binds the data to the views inside the view holder. This creates a RecyclerView with lots of boilerplate code. Right-click the res folder and select New > Vector Asset.Right click on the project folder -> add -> fragment (list) -> finish This will cause the list to refresh with the new item we've inserted (at index 0) Aside: creating a plus icon with Asset StudioĪs the final touchup, we’ll update the FAB’s icon, using Android Studio’s Asset Studio, for creating a vector material icon. Notice the call to recyclerViewAdapter.notifyItemInserted(0). After getting filePath we call PictureContent.loadImage, which adds it to our list.

This is the (quite verbose) way of getting the downloaded file name when the download manager completes the download. This is the auto-generated method that’s added: public void onListFragmentInteraction(Dumm圜ontent.DummyItem item) context.registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) We’ll also make the activity implement our interaction listener interface: implements ItemFragment.OnListFragmentInteractionListenerĪfter adding this to the activity class, you’ll have to implement the onListFragmentInteraction method, you can do it automatically with the suggestion window.


Right click on the project folder -> add -> fragment (list) -> finish
