Hi Renshi,
As the error states, you are trying to get an item at index 0 in an ArrayList (mRecyclerViewItems) that has no elements (size is 0). Based from setUpAndLoadNativeExpressAds() method, you shouldn't traverse through a list that is empty especially if you're going to extract elements from the list inside the loop as this will cause the exception.
Second, in your MainActivity.java, you are calling setUpAndLoadNativeExpressAds() without checking whether the JSON data needed to fill the mRecyclerViewItems list has returned successfully. This resulted to having an empty mRecyclerViewItems list and caused the IndexOutOfBoundsException. Make sure to call setUpAndLoadNativeExpressAds() only when the needed native ads and items are completely added to the mRecyclerViewItems list.
In the
sample app, the filling in of data into the mRecyclerViewItems is executed synchronously and completed before calling setUpAndLoadNativeExpressAds(), which is why the exception was not encountered.
That said, your issue is more on implementation rather than anything specific to Mobile Ads SDK. I suggest that you raise your Android implementation concerns to other developer forums such as StackOverflow.
Regards,
Ivan Bautista
Mobile Ads SDK Team