This is my class
public class TeamUpAttack extends OrmLiteBaseActivity<DatabaseHelper> {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.teamup_attack);
/* more code */
Button toComplete = (Button) findViewById(R.id.attack_confirm);
toComplete.setOnClickListener(toCompleteH);
/* more code */
}
/* more code */
View.OnClickListener toCompleteH = new View.OnClickListener() {
public void onClick(View v) {
try {
List<Player> pl = getHelper().getPlayerDao().query( getHelper().getPlayerDao().queryBuilder().where().not().eq("Posizione", "NA").prepare() );
Log.e("TEAMUPATTACCK", v.getClass().getCanonicalName());
if(pl.size开发者_如何学Python()==11) v.getContext().startActivity(new Intent(v.getContext(), GeneratedFormation.class));
else {
AlertDialog.Builder alert_bld;
alert_bld = new AlertDialog.Builder(TeamUpAttack.this);
alert_bld.setNegativeButton("OK", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = alert_bld.create();
alert.setMessage("You must choose 11 players");
alert.setIcon(R.drawable.icon);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
};
/* more code */
}
What should I pass as an argument to the builder?
i think you are missing alertdialog.show()
method, which displays the control
http://developer.android.com/reference/android/app/AlertDialog.Builder.html
You have to call the show()
method on the AlertDialog
.
精彩评论