Androidstudio pulls this in an attempt to open MaterialDialog in OnClick.



  • What's the mistake (this) in the code

    button2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
             new MaterialDialog.Builder(this)
                    .title(R.string.app_name)
                    .show();
        }
    });
    

    Screen: введите сюда описание изображения



  • MaterialDialog Builder https://github.com/afollestad/material-dialogs/blob/master/core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java#L476 ♪

    You. this - reference to anonymous class OnClickListener

    For example:

    new MaterialDialog.Builder(НазваниеВашегоActivity.this){...}
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2