Java 按钮自动取消乘坐
我有一个按钮,他们叫我 M请求>>wen我按下了按钮,他们叫司机,但如果没有司机,我想设置一个计时器自动取消骑乘请求,只需再次自动按下按钮Java 按钮自动取消乘坐,java,android,firebase,driver,uber-api,Java,Android,Firebase,Driver,Uber Api,我有一个按钮,他们叫我 M请求>>wen我按下了按钮,他们叫司机,但如果没有司机,我想设置一个计时器自动取消骑乘请求,只需再次自动按下按钮 mRequest.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (requestBol){
mRequest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (requestBol){
endRide();
}else {
int selectId = mRadioGroup.getCheckedRadioButtonId();
final RadioButton radioButton = (RadioButton) findViewById(selectId);
if (radioButton.getText() == null) {
return;
}
requestService = radioButton.getText().toString();
requestBol = true;
String userId = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference ref = FirebaseDatabase.getInstance().getReference("customerRequest");
GeoFire geoFire = new GeoFire(ref);
geoFire.setLocation(userId, new GeoLocation(mLastLocation.getLatitude(), mLastLocation.getLongitude()));
pickupLocation = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude());
pickupMarker = mMap.addMarker(new MarkerOptions().position(pickupLocation).title("Aguarde aqui!").icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_pickup)));
Toast.makeText(getApplicationContext(), "Aguarde que estamos localizando o moto táxi mais próximo!!", Toast.LENGTH_LONG).show();
mRequest.setText("Localizando seu moto táxi....");
getClosestDriver();
}
}
});