私の質問は、クリックイベントが発生した後にplaceイベントリスナー(メソッド内のchangestatus())が実行を継続するか、一度だけ呼び出された場合です。は、「実行中」を続行するメソッドです。
public void onClick(View v) {
if (b1.getText()=="Start" && name!=null) {
b1.setText("Stop");
inte.barstatus();
inte.respond("Trying to find buildings near you");
changestatus();
Toast.makeText(getActivity(), "You have to get close to another building.", Toast.LENGTH_LONG).show();
}
else if (b1.getText()=="Start"){
b1.setText("Stop");
inte.barstatus();
inte.respond("Trying to find buildings near you");
changestatus();
}
else{
b1.setText("Start");
inte.barstatus2();
inte.respond("Press Start button to find buildings near you");
}
}
public void changestatus(){
placeEventListener = new PlaceEventListener() {
@Override
public void onVisitStart(Visit visit) {
super.onVisitStart(visit);
name = visit.getPlace().getName().toString();
switch (name) {
case "test1": {
inte.respond(name.toString());
inte.barstatus2();
ToneGenerator toneG = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
toneG.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
break;
}
case "test2": {
inte.respond(name.toString());
inte.barstatus2();
ToneGenerator toneY = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
toneY.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
break;
}
case "Joylamp": {
inte.respond(name.toString());
inte.barstatus2();
ToneGenerator toneT = new ToneGenerator(AudioManager.STREAM_ALARM, 100);
toneT.startTone(ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD, 200);
break;
}
}
}
};
........................................... ............ 私の質問を理解できることを願っています。
placeManager = PlaceManager.getInstance();
placeManager.addListener(placeEventListener);
placeManager.startMonitoring();
CommunicationManager.getInstance().startReceivingCommunications();
....編集plsを参照してください...大丈夫ですか? @Guilherme P –