I have a View class with some clickable bitmaps,in the onTouch method,i want to trigger a new activity when i have touched the bitmaps
Intent newintent = new Intent();
newintent.setClass(view.getContext(),MainMenu.class);
startActivity(newintent);
Since the class does not extends Activity,how can i start an activity without extending Activity?
the current error is :
The method startActivity(Intent) is undefined for the type DrawView
Provided that your
MainMenu.classis anActivityand you call thestartActivity()method from aViewof some sort you need to add aContextfrom which your newActivitywill be started.In your case it would be: