2015-01-22 2 views

답변

3

동일한 수를 관리해야합니다. 이 작업을 수행합니다 :

int touchCount = 0; 

ImageView img = (ImageView) findViewById(R.id.image); 
img.setOnClickListener(new OnClickListener() { 
    public void onClick(View v) { 
     touchCount = touchCount + 1; 
     if (touchCount == 3){ 
       touchCount=0; 
       Intent intent = new Intent(mContext, ActivityA.class); 
       startActivity(intent); 
      }else{ 
       Toast.makeText(getApplicationContext(), 
       "Click more"+ Integer.toString(3-touchCount) +" time to navigate next screen."), 
       Toast.LENGTH_LONG).show(); 
     } 
}); 
+3

좋은 .. + 1하지만 우리가 할 수있는 터치는 출시 후 제로로 활동 –

+0

중 다른 부분이나 활동의 이력서에 돌아 오는 다음 시간 동안 활동을 계산하게 그 – Anjali

+0

tnxxxxxxxxxxx : –

3
ImageView img = (ImageView) findViewById(R.id.img); 
img.setOnClickListener(new View.OnClickListener() { 
    private int clickCount; 

    @Override 
    public void onClick(View v) { 
     if (++clickCount == 3) { 
      Intent intent = new Intent(MainActivity.this, OtherActivity.class); 
      startActivity(intent); 
     } 
    } 
}); 
MainActivity는, 현재 활동의 이름입니다

OtherActivity이 대상이다.

+0

tnxx 톤 .. 제대로 작동 .. :) –

1
int click = 0; 

image.setOnClickListener(new OnClickListener() { 
    public void onClick(View v) { 
     click = click + 1; 
     if (click == 3){ 
       click=0; 
       Intent intent = new Intent(Activity.this, nextActivity.class); 
       startActivity(intent); 
      } 
}); 
+0

tnxxxxx 버디 :) –