0

I am making an app with a ListView. That ListView needs a separate class where you can set the action that happens when you touch an item in the ListView. I programmed it do download a file and show a ProgressDialog.

The error is at this line of code:

myDialog = new ProgressDialog(MainActivity.this);

At MainActivity.this.

Could someone help me to fix the problem?

The whole class is at http://pastebin.com/3rWEKz4r

MaartenDekkers
  • 115
  • 1
  • 1
  • 6

1 Answers1

0

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.

Emmanuel
  • 13,083
  • 4
  • 39
  • 53