I want to perform the actions when the button is pressed not just clicked
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var ib:ImageView=findViewById(R.id.imageView4) as ImageView
var final=MediaPlayer.create(this,R.raw.`m1`)
var anim=AnimationUtils.loadAnimation(this,R.anim.rotate)
ib.setOnTouchListener(){
textView.text="rip"
final.start();
ib.startAnimation(anim);
}
}
}
I want the actions to be performed when the button is held and stop when they are not .