2nd Jan 2022, 1:26 PM
Ulug'bek Burxonov
Ulug'bek Burxonov - avatar
6 Réponses
+ 11
Do you need help for last code coach in kotlin lesson
2nd Jan 2022, 1:27 PM
Ulug'bek Burxonov
Ulug'bek Burxonov - avatar
+ 5
Nyuon Khoryom Nyuon bro use this : class MusicPlayer { private var songs: Array<String> = arrayOf() //your code goes here fun add(track : String){ songs += track } fun show() { var song : String; for (song in songs) println(song) } fun play() { println("Playing "+songs[0]); } } fun main(args: Array<String>) { val m = MusicPlayer() while(true) { var input = readLine()!! if(input == "stop") { break } m.add(input) } m.show() m.play() }
18th Mar 2023, 8:12 AM
Ulug'bek Burxonov
Ulug'bek Burxonov - avatar
+ 1
class MusicPlayer { private var songs: Array<String> = arrayOf() //your code goes here } fun main(args: Array<String>) { val m = MusicPlayer() while(true) { var input = readLine()!! if(input == "stop") { break } m.add(input) } m.show() m.play() } this is my attempt bro and its not working
18th Mar 2023, 1:33 AM
Nyuon Khoryom Nyuon
+ 1
This concept quite helpful :- class MusicPlayer { private var songs: Array<String> = arrayOf() //your code goes here fun add(track : String){ //to add songs songs += track } fun show() { //to show songs var song : String; for (song in songs) println(song) } fun play() { //to play new songs println("Playing "+songs[0]); } } fun main(args: Array<String>) { val m = MusicPlayer() while(true) { var input = readLine()!! if(input == "stop") { break }
8th Jul 2023, 5:28 PM
Pabitra Kumar Sahoo
Pabitra Kumar Sahoo - avatar
0
Nope!
2nd Jan 2022, 1:38 PM
Simba
Simba - avatar
0
Here's a simple example of a music player interface in Kotlin: Create a new Android project in Android Studio. Design your music player layout. For simplicity, you can create a layout file (e.g., activity_main.xml) with buttons for play, pause, stop, and a seek bar to display the progress of the currently playing track. xml Copy code <!-- activity_main.xml --> <LinearLayout xmlns:android="http://schemas.android.com https://artistpush.me/" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center"> <!-- Add UI elements like TextView for displaying song title and artist --> <SeekBar android:id="@+id/seekBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp" /> <Button android:id="@+id/playButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Play" /> <Button android:id="@+id/pauseButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Pause" /> <Button android:id="@+id/stopButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Stop" /> </LinearLayout>
16th Sep 2023, 7:16 PM
HugoRoberts