I have two intents.
Main Activity: Containing the Recycler View, showing some default items to make sure it works. An ArrayList is set to the Recycler View, which is the List containing those default items.

Second Activity: A button which will collect the data on the same page and put the data into an object, the object will be added into the Arraylist which set to the Recycler View of the Main Activity.

I made some Toast Message to confirm the object in the 2nd Activity was added to the ArrayList.

```
//My item
public item(int id, int money, String date, String category, String 
description) {
    this.id = id;
    Money = money;
    Date = date;
    Category = category;
    Description = description;
}

```

Then I created a class to control my ArrayList

```
//Building ArrayList
public Util(){
    Log.d(TAG, "Util: Start");
    if(IncomeItems==null){
        IncomeItems = new ArrayList<>();
        initIncomeItems();
    }        
}
private static void initIncomeItems() {
    Log.d(TAG, "initIncomeItems: initI");
    int Iid = 0
    int Money= 0;
    String Date = "";
    String Category= "";
    String Description = "";

     Iid++;
     IncomeItems.add(new item(Iid, 10000, "8-Jun-2019", "Salary", 
"Salary"));
}

//adding item to ArrayList
public boolean addIncomeItem(item Item){
    Log.d(TAG, "addIncomeItem: addI");
    return IncomeItems.add(Item);
}

//getting ArrayList
public static ArrayList<item> getIncomeItems() {
    Log.d(TAG, "getIncomeItems: getI");
    return IncomeItems;
}

```

I set my ArrayList to the RecyclerView in the Main Activity

```
//Recycler View in Main Activity
RVAdapter IncomeAdapter = new RVAdapter(this);
Util util = new Util();
MainIncomeRV.setAdapter(IncomeAdapter);
MainIncomeRV.setLayoutManager(new GridLayoutManager(this, 1));
IncomeAdapter.notifyDataSetChanged();
IncomeAdapter.setItems(util.getIncomeItems());

```

In the 2nd Activity, I have a button to create a new item by getting data from the user.(I skipped some Widgets intitiation code here). At last I add the item to the ArrayList which set to the Recycler View in the Main Activity.

```
//Button in 2nd Activity
SubmitIncomeBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Date = date_day.getSelectedItem().toString() +"-" + 
date_month.getSelectedItem().toString() + "-" + 
date_year.getSelectedItem().toString();
            id++;
            item IncomeItem = new item(id, 
 Integer.parseInt(Money.getText().toString()), Date, 
IncomeCategories.getSelectedItem().toString(), 
Description.getText().toString());
            util=new Util();
            util.addIncomeItem(IncomeItem);
            Toast.makeText(IncomePage.this, IncomeItem.toString(), 
Toast.LENGTH_SHORT).show();
            Toast.makeText(IncomePage.this, 
String.valueOf(util.getIncomeItems().size()), Toast.LENGTH_SHORT).show();
            Log.d(TAG, "onClick: addI");
        }
    });

}

```

No error occurred, but the item(IncomeItem) created in the 2nd Activity cannot be added to the Main Activity.

I expected the item will show in the Recycler view when I return to the Main Activity. Is it the problem that I use the return button to go back to the Main Activity?