The problem is that you are trying to reference MainActivity
from a different class that reside in completely different files.
Also, it is not the BaseAdapter
's job to inflate and display a Dialog
; it is better design to have the Activity
do it. Doing this will also solve the problem you are having since you will be able to reference the Activity
directly.