I tried to start an activity but it gives me the error message: The method startActivity(Intent) is undefined for the type new View.onClickListener(){}
Here is the code i used the startActivity in.
place.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO If placeButton was clicked:
Intent placepin = new Intent("my.locations.oskar.mendel.PLACEPINACTIVITY");
startActivity(placepin);
}
});
The OnClickListener is an object within your Activity class. Within the onClick codeblock, the Activity’s inherited methods are not going to be visible to the OnClickListener object, hence you will need to adjust the scope accordingly. You likely want something like this: