java - 无法从 ApplicationAdapter 调用 Activity

标签 java android android-activity android-adapter

我刚开始进行 Android 编程,现在我想从 ApplicationAdapter 调用 Activity,但我的代码不起作用。

我有这个 (ApplicationAdapter) 类:

public class Render extends ApplicationAdapter implements SensorEventListener {
// ...
}

...和这个(Activity)类:

public class GameOverActivity extends Activity {
//...
}

什么时候,在 Render 类中我做:

Intent i = new Intent(Render.this, GameOverActivity.class);
startActivity(i);

我在第一行收到这个错误:

"Cannot resolve constructor 'Intent(......)' "

我试图找到其他解决方案,但没有一个奏效。

谁能帮我解决这个问题?

最佳答案

使用 context.startactivity(intent);

关于java - 无法从 ApplicationAdapter 调用 Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34728043/

相关文章:

java - Spring Data MongoDB 连接日志记录

java - 使用 Apache POI 从 Java 中读取 Excel 的公式字段

java - 来自外部存储的 Android 文件选择器不适用于 API 级别 > 24

java - Intent 内 android.util.ArrayMap 中的 ClassNotFoundException

选项菜单中的 Android startActivity 导致应用程序崩溃

java - 使用 Activity 类在 fragment 类中调用方法

android - 在 AsyncTask 完成时完成调用 Activity

java - 如何使用java使用mongodb中的文档来使用 "$or"运算符

java - 优化Java大数据文件读取

Android,沿路径移动位图?