I am having a text field in my project and associated setOnTouchListener with that. In onTouch() I am performing the intended action after clicking on that text field.
I need to write unit test case for onTouch(). Can anyone help me?
public boolean onTouch(View v, MotionEvent event) {
final Intent intent;
switch (v.getId()) {
case R.id.xyz:
intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(getString(R.string.xyz)));
startActivity(intent);
break;
case R.id.abc:
intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(getString(R.string.abc)));
startActivity(intent);
break;
default:
break;
}
return false;
}
So the method i found was :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With