综合技术

I wanted to start a new activity after pressing the three buttons & hellip; Please&com…

微信扫一扫,分享到朋友圈

I wanted to start a new activity after pressing the three buttons & hellip; Please&com…

Hi i am creating a simple educational game in which user has to press three images in order to proceed to the next level and in next level user has to press 5 images.

i have gone through the on click but i using on Intent intent = new Intent(this.getApplicationContext(), Activity.class); this.startActivity(intent, 0);
i am only able to start new activity on single button pressed but i wanted to start new activity when user has finished pressing three image Buttons.

Thanks in advanced.

you can use global int variable and increase it every button click and if its more than your button number open new activity

public int btn = 0;

  MyButton.setOnClickListener(new OnClickListener()
{
 @Override
 public void onClick(View v)
 {
     if(btn >= 2) {

//open your activity 

}   

else{
btn++;
}
  }
});

html.js - Write HTML in JS easily.

上一篇

面试题之-深拷贝

下一篇

你也可能喜欢

评论已经被关闭。

插入图片

热门栏目

I wanted to start a new activity after pressing the three buttons & hellip; Please&com…

长按储存图像,分享给朋友