the problem is that i only recieve the data that sent from the client to the server after hitting the imagebutton and the event was action down. i found out that the checking on event_up never send the data - the if never happanes. the part of the code looks like that :
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (v.getId()) {
case R.id.Abtn:
onControl("BA", event);
break;
case R.id.Bbtn:
onControl("BB", event);
break;
case R.id.Xbtn:
onControl("BX", event);
break;
case R.id.Ybtn:
onControl("BY", event);
break;
case R.id.Rbtn:
onControl("BR", event);
break;
case R.id.Lbtn:
onControl("BL", event);
break;
case R.id.UpBtn:
onControl("BU", event);
break;
case R.id.Dbtn:
onControl("BD", event);
break;
case R.id.RTbtn:
onControl("RT", event);
break;
case R.id.LTbtn:
onControl("LT", event);
break;
case R.id.Start_btn:
onControl("ST", event);
break;
case R.id.Back_btn:
onControl("CK", event);
break;
case R.id.RB_btn:
onControl("RB", event);
break;
case R.id.LB_btn:
onControl("LB", event);
break;
}
return true;
}
on control:
private void onControl(String st, MotionEvent event){
if(event.getAction() == MotionEvent.ACTION_DOWN){
new SendMessage().execute("S"+ st);
}
else if(event.getAction() == MotionEvent.ACTION_UP){
new SendMessage().execute("P "+ st);
}
}
i checked in the internet and every answer says i need to return true, but im doing it in OnTouch. i cant figure out the solution myself. important to say that the app itself is only landscape so there is no need for check for action_cancled...