When I open a new activity from my listview activity and then go back to listview activity or if I reopen that same listview actvity , my listview items gets repeated.

```
public class PlaylistAdapter extends ArrayAdapter<PlaylistBean> {

    Context context;
    private LayoutInflater inflater;

    public static class ViewHolder
    {
        public final TextView name;
        public final ImageView image;

        public ViewHolder(View view)
        {
            name = (TextView) view.findViewById(R.id.namePlaylist);
            image = (ImageView) view.findViewById(R.id.imagePlaylist);
        }
    }

    public PlaylistAdapter(Context context, List<PlaylistBean> items)
    {
        super(context, R.layout.row_layout_playlist, items);
        inflater = LayoutInflater.from(context);
    }

    @Override
    public View getView(final int position, View convertView, final ViewGroup parent)
    {
        View view = convertView;
        if (view == null)
        {
            LayoutInflater vi = LayoutInflater.from(getContext());
            view = vi.inflate(R.layout.row_layout_playlist, null);
        }

       final ViewHolder viewHolder = new ViewHolder(view);
        PlaylistBean playlistBean = getItem(position);

        viewHolder.name.setText(playlistBean.getName());
        viewHolder.image.setImageResource(playlistBean.getImage());

        return view;
    }

}

```

Here is my code for PlaylistBean class

```
public class PlaylistBean implements Serializable {

    private int image;
    private String name;

    public PlaylistBean(int image, String name)
    {
        this.image = image;
        this.name = name;
    }

    public int getImage() {
        return image;
    }

    public void setImage(int image) {
        this.image = image;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

```

Here is the code for my main activity

public class Playlist extends AppCompatActivity {

```
public static List<PlaylistBean> items = new ArrayList<>();
ArrayAdapter<PlaylistBean> myArrayAdapter;

 @Override
     protected void onCreate(Bundle savedInstanceState) 
{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_playlist);

        playlistListView = (ListView) findViewById(R.id.playlistListView);
        myArrayAdapter = new PlaylistAdapter(Playlist.this, items);
         playlistListView.setAdapter(myArrayAdapter);

            createData();

}

 public void createData()
    {
        PlaylistBean bean1 = new PlaylistBean(R.drawable.popular_upload, "Popular Uploads");
    items.add(bean1);
}

```

}