Joakim Engstrom
Joakim Engstrom

Reputation: 6403

Android - new intent and activity problems

I'm developing an android app, and have developed a game, but I now have stupid problem. You control a UFO and when it's health will be reduced to zero the game should be over. How should I contruct gameOver?

Previous I've used an intent to open a new activity but this requires the class to extend Activity, and since I want the mainthread to look up when the UFO has his health reduced to zero I can't just call GameActivity.gameOver since it want to use a static method to be called, and since a static method can't contain a new intent I can't figure it out.

Upvotes: 0

Views: 424

Answers (1)

Pentium10
Pentium10

Reputation: 207830

A static method can contain an intent.

Pass a Context in a param of the static method and use that to launch a new Context.

Upvotes: 1

Related Questions