Segue print: ![]( )
Segue código:
package br.com.alura.orgs.ui.activity
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.PersistableBundle
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.EditText
import br.com.alura.orgs.R
import br.com.alura.orgs.model.Product
import java.math.BigDecimal
class ProductFormActivity :
AppCompatActivity(R.layout.activity_product_form) {
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
val botaoSalvar = findViewById<Button>(R.id.salvar)
botaoSalvar.setOnClickListener(object : View.OnClickListener {
override fun onClick(p0: View?) {
val campoNome = findViewById<EditText>(R.id.nome)
val nome = campoNome.text.toString()
val campoDescricao = findViewById<EditText>(R.id.descricao)
val descricao = campoDescricao.text.toString()
val campoValor = findViewById<EditText>(R.id.valor)
val valor = campoValor.text.toString()
Log.i("ProductFormActivity", "onCreate: $nome")
val produtoNovo = Product(
nome = nome,
descricao = descricao,
valor = BigDecimal(valor)
)
Log.i("ProductFormActivity", "onCreate: $produtoNovo")
}
})
}
}