82.7 Initializing the Activity
The next step is to modify the activity to perform a number of initialization tasks. Remaining within the MainActivity.kt file, modify the code as follows:
.
.
import android.media.MediaRecorder
import android.os.Environment
import android.view.View
import android.media.MediaPlayer
.
.
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
private var mediaRecorder: MediaRecorder? = null
private var mediaPlayer: MediaPlayer? = null
private var audioFilePath: String? = null
private var isRecording = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding...