Last active
November 10, 2019 10:36
-
-
Save carotkut94/a3db210a102fe534d1e93dc96d806704 to your computer and use it in GitHub Desktop.
After adding the button and alert dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.death.demo | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.compose.Composable | |
import androidx.compose.State | |
import androidx.compose.state | |
import androidx.compose.unaryPlus | |
import androidx.ui.core.Text | |
import androidx.ui.core.setContent | |
import androidx.ui.layout.Column | |
import androidx.ui.layout.Container | |
import androidx.ui.material.AlertDialog | |
import androidx.ui.material.Button | |
import androidx.ui.material.MaterialTheme | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
MaterialTheme { | |
Column { | |
showAlertButton() | |
presentDialog() | |
} | |
} | |
} | |
} | |
@Composable | |
fun showAlertButton(){ | |
Button("Show Alert", | |
onClick = { | |
} | |
) | |
} | |
@Composable | |
fun presentDialog() { | |
AlertDialog( | |
onCloseRequest = { | |
}, | |
title = { | |
Text(text = "Alert Dialog") | |
}, | |
text = { | |
Text("JetPack Compose Alert Dialog!") | |
}, | |
confirmButton = { | |
Button("Confirm", onClick = { | |
}) | |
} | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment