0

I am developing a small libgdx game. I want to call an Activity class from AndroidApplication class. I used the following code

context.startActivity(new Intent(MyClass.this,NewActivity.class));

Thanks in advance

Kanwaljit Singh
  • 4,339
  • 2
  • 18
  • 21
varghesekutty
  • 205
  • 4
  • 13

3 Answers3

1

Use this:

Intent i = new Intent(MainActivity.this, NewActivity.class); 
startActivity(i);
Lysdexia
  • 453
  • 8
  • 22
markas
  • 91
  • 6
1

Try one of the code-

Intent i = new Intent(MyClass.this, NewActivity.class);
startActivity(i);

Or

Intent i= new Intent(getBaseContext(), NewActivity.class);
startActivity(i);

Or

startActivity(new Intent(MyClass.this, NewActivity.class));
Kanwaljit Singh
  • 4,339
  • 2
  • 18
  • 21
0

Use like this

Intent i=new Intent(MyClass.this,NewActivity.class); startActivity(i);

Sukan
  • 346
  • 1
  • 3
  • 19