Skip to content

Instantly share code, notes, and snippets.

// we would be writing this reptitive code multiple times for similar dialogs
MaterialAlertDialogBuilder(context)
.setTitle(R.string.confirmation_dialog_title)
.setMessage(R.string.confirmation_dialog_message)
.setIcon(R.drawable.ic_feedback)
.setPositiveButton("Okay") { _, _ ->
deleteItem()
}
.setNegativeButton("Cancel", null)
.setCancelable(false)
@Williamrai
Williamrai / rememberIntro.kt
Created April 21, 2024 17:44
Jetpack compose remember function intro sample
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment