i want to fill the TextView with character while Button is Down i wrote this code but it just writes one character ?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button b = (Button) findViewById(R.id.btn);
final TextView tv =(TextView) findViewById(R.id.txt1);
b.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN){
String s = tv.getText().toString();
tv.setText( s + "E");
return false;
}
return false;
}
});
}
how can i fill the textview with a character while button state is down ?