2014-12-11

Practice final Question 8 (Android) .

<nowiki> public TripleTapView exdends View { private tapcount; private TapCounter tc = new TapCounter(delay);

.
.
.

@override
protected onTouchEvent(MotionEvent e){
	switch (e.getAction()) {
		case e.ACTION_DOWN:
			tc.resetCounter();
			tapcount++;
			break;
	}
}

class TapCounter extends CountDownTimer {
.
.
.

	@override
	public void onFinsish(){
		if(tapcount == 3){
			//add code for what you want executed at 3 taps.
		}
		lasttapcount = 0;
	}

}

} </nowiki>

<nowiki> public TripleTapView exdends View { private tapcount; private TapCounter tc = new TapCounter(delay); . . . @override protected onTouchEvent(MotionEvent e){ switch (e.getAction()) { case e.ACTION_DOWN: tc.resetCounter(); tapcount++; break; } } class TapCounter extends CountDownTimer { . . . @override public void onFinsish(){ if(tapcount == 3){ //add code for what you want executed at 3 taps. } lasttapcount = 0; } } } </nowiki>

-- Practice final Question 8 (Android)

Students who added this question:

Kenan Ozdamar

Sreenidhi Muralidharan

Students who added this question: Kenan Ozdamar Sreenidhi Muralidharan
X