按钮 使用匿名内部类 的一些问题

量化分析 量化分析 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
poker_bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//使用整个包名来跳转
Intent intent=new Intent();
//Intent intent=new Intent(MainActivity.this,poker_game.class);
intent.setClassName(this,"com.example.hackertool.poker_game");
//intent.setClassName(MainActivity.this, "com.example.hackertool.poker_game");

startActivities(intent);

}
});
//为什么失败了?

我是初哥,所以 我觉得是不是 在 this的地方 应该用 Mainactivity.this ?

返回的错误信息是:

Error:(39, 17) error: no suitable method found for startActivities(Intent)
method Activity.startActivities(Intent[],Bundle) is not applicable
(actual and formal argument lists differ in length)
method Activity.startActivities(Intent[]) is not applicable
(actual argument Intent cannot be converted to Intent[] by method invocation conversion)
method ContextWrapper.startActivities(Intent[],Bundle) is not applicable
(actual and formal argument lists differ in length)
method ContextWrapper.startActivities(Intent[]) is not applicable
(actual argument Intent cannot be converted to Intent[] by method invocation conversion)
method Context.startActivities(Intent[],Bundle) is not applicable
(actual and formal argument lists differ in length)
method Context.startActivities(Intent[]) is not applicable
(actual argument Intent cannot be converted to Intent[] by method invocation conversion)
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
量化分析
Android 80,490 成员 91,371 内容