【发布时间】:2023-05-30 02:33:01
【问题描述】:
我在投射活动时遇到了一点问题,当我单击菜单中的项目以打开活动时,应用程序崩溃并且 logcat 说它可以投射活动。问题出在这一行:
_Sapp = (SecondActivityApp)getApplicationContext();
我认为是getApplicationContext,但我不确定。我该如何解决?
【问题讨论】:
-
请发布整个堆栈跟踪,
_Sapp声明为什么类型?你想做什么? -
这是
private SecondActivityApp _Sapp = null;的声明方式 -
SecondActivityApp 是如何定义的?它是一个上下文吗?
-
我要打开带有 Intent 的活动吗?
-
无?:(很重要
标签: android android-activity casting android-context