Clicking on "A" and dragging on the square "B", that would work in TextView AB .... here is my implementation but it doesn't work :(
public class MainActivity extends Activity implements View.OnTouchListener { Button btn, btn2; TextView txw; String dates; int slide = 100; float x; float y; @SuppressLint("ClickableViewAccessibility") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.btn); btn2 = (Button) findViewById(R.id.btn2); txw = (TextView) findViewById(R.id.txw); btn.setOnTouchListener(this); btn2.setOnTouchListener(this); txw.setOnTouchListener(this); } @SuppressLint("SetTextI18n") @Override public boolean onTouch(View view, MotionEvent motionEvent) { x = motionEvent.getX(); y = motionEvent.getY(); float ex = btn2.getX(); float ey = btn2.getY(); switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: // Π½Π°ΠΆΠ°ΡΠΈΠ΅ dates = (String) btn.getText(); Log.e(TAG, "onTouch: DAtes = =" + dates ); break; case MotionEvent.ACTION_MOVE: // Π΄Π²ΠΈΠΆΠ΅Π½ΠΈΠ΅ if (x >= ex && x <= ex && y >= ey && y <= ey ){ dates = dates+btn2.getText(); } break; case MotionEvent.ACTION_UP: // ΠΎΡΠΏΡΡΠΊΠ°Π½ΠΈΠ΅ break; case MotionEvent.ACTION_CANCEL: break; } txw.setText(dates); return true; } 