How to put some delay in calling an activity from another activity?

后端 未结 7 2380
难免孤独
难免孤独 2020-12-03 05:31

I have an application in which I\'m receiving a sms containing his location.On receiving sms it calls another activity to start and passes that location to that activity to

7条回答
  •  再見小時候
    2020-12-03 05:57

    An example would be the following:

    Handler TimeDelay=new Handler();
                    if(previous=="geofence"){
    
    
    
                        tts.speak(previous,TextToSpeech.QUEUE_ADD,null, null);
                        Runnable r = new Runnable() {
                            @Override
                            public void run() {
                                /*
                                Intent intent = new Intent(
                                        MyBroadcastMessageReceiver.class.getName());
                                intent.putExtra("some additional data", choice);
                                someActivity.sendBroadcast(intent);*/
                                tts.speak(previous,TextToSpeech.QUEUE_ADD,null, null);
                            }
                        };
                        TimeDelay.postDelayed(r, 150000);
    

提交回复
热议问题