Eu não sei como declarar o ShowAlert para funcionar dentro do meu método. Alguém tem uma luz?
Erro:
The method ShowAlert(…) is undefined for the type new View.OnClickListener(){}.
package br.android.supermercado;
import android.app.Activity;
import android.os.Bundle;
import android.widget.*;
import android.view.*;
public class appSupermercado extends Activity {
CheckBox chkleite,chkrefri,chkcarne,chkarroz,chkfeijao;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
chkleite = (CheckBox)findViewById(R.item.chkarroz);
chkrefri = (CheckBox)findViewById(R.item.chkrefri);
chkcarne = (CheckBox)findViewById(R.item.chkcarne);
chkarroz = (CheckBox)findViewById(R.item.chkarroz);
chkfeijao = (CheckBox)findViewById(R.item.chkfeijao);
Button btTotal = (Button)findViewById(R.botao.btCalc);
btTotal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
double total=0;
if(chkleite.isChecked())
total += 5;
if(chkrefri.isChecked())
total += 2;
if(chkcarne.isChecked())
total += 10;
if(chkarroz.isChecked())
total += 2.69;
if(chkfeijao.isChecked())
total += 2.30;
else
total += 0;
showAlert("Total da Compra: ",0,String.valueOf(total),"OK",false); //ERRO APARECE NESTA LINHA!!!!!
}
});
}
}
