I am trying to use a Button in an AlertDialog to view a webpage.
The problem is that this AlertDialog is located inside a class that extends ItemizedOverlay and doesn’t extend Activity, so Eclipse underlines it and gives the following error:
The method startActivity() is undefined for the type new DialogInterface.OnClickListener(){}
I would like to launch activities from the PositiveButton, NeutralButton and NegativeButton, but I am not able to.
In case you need more context, the main Activity is a MapView with some ItemizedOverlay, and I would like to launch a webpage with directions or another activity that does that.
Construct a constructor in the class which contains your alert with
Contextobject as a parameter. Assign it to a Context variable.Use this context variable for creating the intent.