최근에 노래를 재생 한 음악 플레이어 재생 목록을 만들고 있습니다. 나는 노래의 arraylist와 공유 환경 설정에서 재생되고있는 노래의 색인을 저장하고있다. 내가 최근에 연주 한 노래를 얻으려고하는 것은 공유 환경 설정에서 arraylist와 노래 색인을 가져 와서 다른 arraylist에 저장하는 것입니다. 그러나 문제는 recyclerView가 한 번에 하나의 노래 만 표시한다는 것입니다.최근에 재생 한 노래를 검색하는 방법은 무엇입니까?
예를 들어, 내가 A 곡을 재생하면 recyclerView가 노래 A를 첫 번째 위치에 표시하고 B 노래를 재생하면 recyclerView가 B 곡을 첫 번째 위치에 표시하고 A 곡을 두 번째 위치에 표시해야합니다. 그러나 그것은 단지 첫 번째 위치를 보여줍니다.
RecentlyPLayedsongs.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutInflater inflater = LayoutInflater.from(this);
View view6 = inflater.inflate(R.layout.activity_recently_played, null);
FrameLayout container6 = (FrameLayout) findViewById(R.id.container);
container6.addView(view6);
recyclerView_recently_played = findViewById(R.id.recyclerView_recently_played);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView_recently_played.setLayoutManager(linearLayoutManager);
StorageUtil storageUtil2 = new StorageUtil(getApplicationContext());
SongList=storageUtil2.loadAudio();
pos = storageUtil2.loadAudioIndex();
songInfoModel = SongList.get(pos);
RecentlyPlayedList.add(songInfoModel);
adapter1 = new Playlist_Recently_Added_Adapter(RecentlyPlayedList, getApplicationContext());
recyclerView_recently_played.setAdapter(adapter1);
}
이는 노래 b가 재생 될 때 배열의 두 번째 위치에 추가한다는 의미입니까? –
노래 B가 연주 될 때 노래 A가 두 번째 위치에 추가되고 노래 B가 일반 음악 플레이어처럼 첫 번째 위치에 추가되기를 원합니다. – Rektirino