How do I add an item to a RecyclerView at an index that currently has an item and retain any items that exist below it in stacking order? For example, if I have this list:
item = 0, item 1, item 2, ...
I want to insert an item into an existing index but without replacing the original value:
item = 0, item A, item 1, item 2, ...
The code I have used so far is:
public void addRecyclerObject(int position, Object recyclerObject) {
recyclerObjects.add(position, recyclerObject);
notifyItemInserted(position);
}
However, when I use execute the above code, the RecyclerView renders as such:
item = 0, item A, item 2, ...
item 1 is completely removed and replaced with another value. How can I insert another item without replacing an existing value? Any suggestions?
Listto generate the items within the RecyclerView?