if ステートメントが満たされたときにアラームを鳴らし、ダイアログ ボタンでオフにしたい。
googleMap.setOnInfoWindowClickListener(
new OnInfoWindowClickListener() {
public void onInfoWindowClick(Marker marker) {
LatLng clickedMarkerLatLng = marker.getPosition();
lat = clickedMarkerLatLng.latitude;
long1 = clickedMarkerLatLng.longitude;
String name = marker.getTitle();
select=true;
final Location markerLoc = new Location("");
markerLoc.setLatitude(lat);
markerLoc.setLongitude(long1);
final Location location = locationManager.getLastKnownLocation(provider);
float distanceBetweenPoints = location.distanceTo(markerLoc);
TextView t = (TextView) findViewById(R.id.tv_location);
t.setText("Distance to "+ name +" is "+ distanceBetweenPoints/1000 + " km");
if (distanceBetweenPoints<1000){
TextView t2 = (TextView) findViewById(R.id.tv_location);
t2.setText("ALARMALARMALARM");
//alarm here
}
});
Alarm Manager について私が見つけたものはすべて、if ステートメントで使用できないようです。どうすればこれを行うことができますか?