public void saveNewPlayList(String name) {
        Playlist pl = new Playlist();
        pl.setName(name);
        pl.save();
        List<String> selectedVideos = videoGridAdapter.getCheckedItems();
        List<Video> myVideos = new ArrayList<>();
        // TODO Here I define the order for which I want the videos to play.
        // Could try diferent ordering for the playlists
        // For now it just accepts the gridAdapter selected array order
        int order = 0;
        for (String vid : selectedVideos) {
            Video video = new Video();
            video.setUri(vid);
            video.setPlaylist(pl);
            video.setOrder(order);
            order++;
            myVideos.add(video);
        }
        Video.saveAll(myVideos);
        updatePlaylistList();
        cancelCreatePlaylist();
    }
public void saveNewPlayList(String name) {
        Playlist pl = new Playlist();
        pl.setName(name);
        pl.save();
        List<String> selectedVideos = videoGridAdapter.getCheckedItems();
        List<Video> myVideos = new ArrayList<>();
       
       
       
        int order = 0;
        for (String vid : selectedVideos) {
            Video video = new Video();
            video.setUri(vid);
            video.setPlaylist(pl);
            video.setOrder(order);
            order++;
            myVideos.add(video);
        }
        Video.saveAll(myVideos);
        updatePlaylistList();
        cancelCreatePlaylist();
    }
public void savenewplaylist(string name) { playlist pl = new playlist(); pl.setname(name); pl.save(); list<string> selectedvideos = videogridadapter.getcheckeditems(); list<video> myvideos = new arraylist<>(); int order = 0; for (string vid : selectedvideos) { video video = new video(); video.seturi(vid); video.setplaylist(pl); video.setorder(order); order++; myvideos.add(video); } video.saveall(myvideos); updateplaylistlist(); cancelcreateplaylist(); }