Skip to content

Conversation

TTRR1007
Copy link

10주차 과제 제출입니다.

'첫 화면 하단에 현재 재생중인 음악을 표시한다'라는 부분을 구현하는데 실패하였습니다.
recyclerView를 전체 재생목록과 현재 재생중인 음악으로 나누어서 구현해보려 했는데 생각처럼 작동하지가 않네요.
일단 현재 완성한 부분을 먼저 올린 후 해당 부분 구현을 성공한다면 추가적으로 제출해보도록 하겠습니다.

추가로 strings.xml 사용이나 지난주에 말씀하셨던 'string의 naming convention을 xml id값과 동일하게 하지 않는다' 부분을 추가적으로 설명 해주실 수 있으신가요?
어느 부분에서 strings.xml을 사용해야 하는지와 지난주 말씀하신 내용과 같은 부분을 아직 정확하게 잘 모르겠습니다.

@TTRR1007 TTRR1007 changed the title [김영수_Android] 9주차 과제 제출 [김영수_Android] 10주차 과제 제출 Jun 30, 2025
Copy link
Contributor

@kongwoojin kongwoojin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다.
질문하신 부분은 bindService를 사용해서 해결할 수 있습니다

strings.xml 같은 경우, 저번주차 과제에서 xml id값과 동일하게 이름을 지으셔서 말씀 드린겁니다 (예: text view의 id가 text_view_title이면 string.xml의 이름도 text_view_title이었습니다)

holder.titleTextView.text = item.name
holder.artistTextView.text = item.artist

val totalTime = item.duration/1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

별도의 확장함수로 분리하는게 좋을 것 같습니다

import kotlinx.coroutines.launch


class AudioListManager(application: Application) : AndroidViewModel(application) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewModel 사용을 시도한 것은 좋은데, ViewModel은 이렇게 사용하면 안됩니다.
자세한건 13주차 아키텍쳐에서 설명하겠습니다.

import androidx.core.app.NotificationCompat


@Suppress("DEPRECATION")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필요한 annotation인가요?



@Suppress("DEPRECATION")
class AudioPlayer : Service() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BindService 사용해주세요


private fun showNotification(title: String) {
val channelId = "music_channel"
val channelName = "음악 재생 채널"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

채널 id와 이름은 일반적으로 상수로 선언합니다

super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

permissionName = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

READ_MEDIA_AUDIOREAD_EXTERNAL_STORAGE 허용 창이 뜨지 않습니다.
확인 부탁드려요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants