KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to start an AlertDialog from an onClickListener but I'm getting the following error. The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined Does anyone know how to fix this? mRecordButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { new AlertDialog.Builder( this ) .setTitle( "Cast Recording" ) .setMessage( "Now recording your message" ) .setPositiveButton( "Save", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Log.d( "AlertDialog", "Positive" ); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Log.d( "AlertDialog", "Negative" ); } } ) .show(); } });
Tags (comma-separated)
Save Edits
Cancel