1

I am trying to add a ListView on my DialogFragment, but I am getting the following error:

enter image description here

William Barbosa
  • 4,936
  • 2
  • 19
  • 37
casillas
  • 16,351
  • 19
  • 115
  • 215

2 Answers2

1

You are inside a fragment so you need to use the fragments Activity property.

tequila slammer
  • 2,821
  • 1
  • 18
  • 25
1

You are inside a DialogFragment and you're trying to pass it as the first argument of your Adapter. It, however, expects a Context instead of a fragment, hence the error.

You should replace the this in your Adapter's constructor with Activity, the property of your adapter that contains and Activiy (which is a Context)

Community
  • 1
  • 1
William Barbosa
  • 4,936
  • 2
  • 19
  • 37