title: incompatible types: cannot be converted to Context
body: <p>I am and getting an error when trying to modify code to handle documents in <code>Android Nougat</code>. </p>
  
  <blockquote>
    <p>incompatible types: cannot be converted to Context</p>
  </blockquote>
  
  <p>This is my code</p>
  
  <pre><code>    documentViewHolder.preview.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      File document = new File(Environment.getExternalStorageDirectory() + "/heyJudeDocuments/" + getItem(position).attachment_id);  // -&gt; filename = maven.pdf 
                      Uri path = FileProvider.getUriForFile(MessageAdapter.this,BuildConfig.APPLICATION_ID + ".provider",document);
                      Intent docIntent = new Intent(Intent.ACTION_VIEW);
                      docIntent.setDataAndType(path, getItem(position).mime);
                      docIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                      docIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  </code></pre>
  
  <p>It's the <code>MessageAdapter.this</code> part that seems to be wrong. Can someone point out where I am going wrong?</p>