カスタム ダイアログを作成しようとしています。メソッドを呼び出すとsetOnClickListner
、「型ビューの setOnClickListner メソッドは引数に適用できません」というメッセージが表示されます。次の行にもエラーが表示されます。
public void onClick(View v)
「タイプ new OnClickListener(){} のメソッド onClick(View) は、スーパータイプ メソッドをオーバーライドまたは実装する必要があります」と言っています。コード:
void ReStartsFamilyFriend()
{
// custom dialog
// custom dialog
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.gameover);
dialog.setTitle("Title...");
// set the custom dialog components - text, image and button
Button dialogButton = (Button) dialog.findViewById(R.id.butPlay);
// if button is clicked, close the custom dialog
//on this line below get the error "The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments "
dialogButton.setOnClickListener(new OnClickListener() {
@Override
/*On the line below I get the error
"The method onClick(View) of type new OnClickListener(){} must override or implement a supertype
method"*/
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}