I need update my code from showAlert(1.1) to AlertDialog (1.5) but an error occurs
"The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined"
Using java Syntax Highlighting
- package com.android.appcadastro;
- import android.app.Activity;
- import android.app.AlertDialog;
- import android.app.Dialog;
- import android.os.Bundle;
- import android.widget.*;
- import android.view.*;
- public class AppCadastro extends Activity {
- /** Called when the activity is first created. */
- Registro pri,reg,ult,aux;
- EditText ednome,edprof,edidade;
- int numreg,pos;
- void CarregaTelaCadastro() {
- setContentView(R.layout.cadastro);
- Button btcadastrar = (Button) findViewById(R.cadastro.btcadastro);
- Button btvoltar = (Button) findViewById(R.cadastro.btvoltar);
- btcadastrar.setOnClickListener(new View.OnClickListener(){
- public void onClick(View arg0){
- try {
- reg = new Registro();
- ednome = (EditText)findViewById(R.campo.nome);
- edprof = (EditText)findViewById(R.campo.profissao);
- edidade = (EditText)findViewById(R.campo.idade);
- reg.nome = ednome.getText().toString();
- reg.profissao = edprof.getText().toString();
- reg.idade = edidade.getText().toString();
- if(pri==null)
- pri=reg;
- reg.Ant = ult;
- if(ult==null)
- ult=reg;
- else {
- ult.Prox = reg;
- ult=reg;
- }
- numreg++;
- AlertDialog dialog = new AlertDialog.Builder(this).create();
- dialog.setTitle("OK");
- dialog.setMessage("Cadastro efetuado com sucesso");
- dialog.show();
- }
- catch(Exception e) {
- AlertDialog dialog1 = new AlertDialog.Builder(this).create();
- dialog1.setTitle("Erro!");
- dialog1.setMessage("Erro no cadastro");
- dialog1.show();
- }}
- });
Parsed in 0.039 seconds, using GeSHi 1.0.8.4
somebody knows how to solve it?
tks!



