I'm trying to create a budget application on Android Studio (complete beginner), and I'm currently having an issue:
I basically have a listView where I can add any of my purchases (name and value + the day I buy it)

Whenever I add an element to my listview, instead of adding another element, the new one gets duplicated.
For example if I have Element1 already in the listview and I add "Element2", I'm going to get "Element2" and "Element2" again, with the other elements being replaced.
I think there is something wrong with my adapter or my view but I can't figure it out...

Any help would be much appreciated

```
public class CustomPopUp extends AppCompatDialogFragment {
private EditText editTextName;
private EditText editTextValue;
private CustomPopUpListener listener;
private Calendar calendar;
private static String name;
private static String currentDate;
private static Float value;

@Override
public Dialog onCreateDialog (Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final AlertDialog ad = builder.show();

    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.activity_ajouter_pop_up, null);

    calendar = Calendar.getInstance();

    builder.setView(view)
            .setTitle("Add element")
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    ad.dismiss();
                }
            })
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    name = editTextName.getText().toString();
                    String s = editTextValue.getText().toString();
                    value = Float.parseFloat(s);
                    String currentDate = DateFormat.getDateInstance().format(calendar.getTime());
                    listener.applyChanges(name, currentDate, value);
                    ad.dismiss();
                }
            });

    editTextName = view.findViewById(R.id.item_edit_text);
    editTextValue = view.findViewById(R.id.item_edit_value);

    return builder.create();
}

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    try {
        listener = (CustomPopUpListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + "must implement CustomPopUpListener");
    }
}

```

}

MainActivity:

```
@Override
public void applyChanges(String name, String currentDate, Float value) {
    purchase = new Purchase(name, currentDate, value);
    items.add(purchase);
    adapter = new PurchaseListAdapter(getApplicationContext(), R.layout.adapter_view_layout, items);
    itemsListView.setAdapter(adapter);
}

```

}

```
public class PurchaseListAdapter extends ArrayAdapter<Purchase> {
private static final String TAG ="PurchaseListAdapter";

private Context mContext;
private int mResource;

public PurchaseListAdapter(Context context, int resource, ArrayList<Purchase> objects) {
    super(context, resource, objects);
    mContext = context;
    mResource = resource;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    String name = CustomPopUp.getName();
    String currentDate = CustomPopUp.getCurrentDate();
    Float value = CustomPopUp.getValue();
    String sValue = Float.toString(value);

    Purchase purchase = new Purchase(name, currentDate, value);

    LayoutInflater inflater = LayoutInflater.from(mContext);
    convertView = inflater.inflate(mResource, parent, false);

    TextView tvName = (TextView) convertView.findViewById(R.id.textView25);
    TextView tvCurrentDate = (TextView) convertView.findViewById(R.id.textView26);
    TextView tvValue = (TextView) convertView.findViewById(R.id.textView27);

    tvName.setText(name);
    tvCurrentDate.setText(currentDate);
    tvValue.setText(sValue);

    return convertView;
}

```

}

ItemsListView:

```
<ListView
    android:id="@+id/items_list"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="28dp"
    android:layout_marginEnd="8dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/progressBar" />

 itemsListView = (ListView) findViewById(R.id.items_list);

```

My "adapter\_view\_layout" is composed of 

```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="100">

    <TextView
        android:gravity="center"
        android:textAlignment="center"
        android:text="TextView1"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:id="@+id/textView25"
        android:layout_weight="66.6"/>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="33.3">

        <TextView
            android:gravity="center"
            android:text="TextView2"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:id="@+id/textView26"/>

        <TextView
            android:gravity="center"
            android:text="TextView3"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:id="@+id/textView27"
            android:layout_below="@+id/textView2"/>

```