버튼을 클릭하면 텍스트가 표시됩니다. 이것은 작동 중입니다. 버튼 클릭 한도를 초과 할 때마다 사용자 정의 텍스트가 표시되어야합니다. 버튼을 세 번 클릭하면 사용자가 정의한 것이 아닌 일부 텍스트가 표시됩니다.조건 켜기 버튼 클릭
final Button btnca =(Button) findViewById(R.id.btnca);
btnca.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int c=1;
if(c <= 3) //if button click for first three times
{
new FancyShowCaseView.Builder(Playing.this)
.title(questionPlay.get(index).getCorrectAnswer())
.build()
.show();
score -= 10;
txtScore.setText(String.format("%d", score));
c++;
}
if(c>3) //if button click for after three times
{
new FancyShowCaseView.Builder(Playing.this)
.title("Your Limit Exceed")
.build()
.show();
}}
});
'setOnClickListener' 메소드 밖에서 'int c = 1'을 선언하십시오. –