Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android- calling Intent from an Inner class

i want to call a new activity from within an inner class which is defined in d class which extends Activity.... the piece of written in one of the methods of that Inner class is::

Intent intent = new Intent(this, Test2.class); startActivity(intent);

Test2 is placed inside the same package as my main clas is placed and eclipse is showing me d error "The constructor Intent(test.MyTimer, Class) is undefined".......

what is the solution??

like image 700
poojan9118 Avatar asked Jul 09 '10 11:07

poojan9118


1 Answers

Just use MyActivity.this like so:

Intent i = new Intent(MyActivity.this, MyActivity.class);
like image 89
Pentium10 Avatar answered Sep 21 '22 01:09

Pentium10