上面this哪里报错,应该如何解决
public static class InnerSplashHandler extends Handler{
WeakReference<SplashActivity> mWeakReference;
Context mContext;
public InnerSplashHandler(SplashActivity splashActivity) {
this.mWeakReference = new WeakReference<>(splashActivity);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what){
case StaticClass.HANDLER_SPLASH:
mContext.startActivity(this,GuideActivity.class);
this这里报错,提示startActivity(android.content.Intent,android.os.Bundle)in Context cannot be applied to
break;
}
}
1 回答
已采纳
不忘初心__
TA贡献3条经验 获得超0个赞
你的 mContext 没有初始化,应该在外部类中定义 Context mContext = this;
或者使用另一种方法: 外部类名.this.startActivity();
- 1 回答
- 0 关注
- 1284 浏览
添加回答
举报
0/150
提交
取消