Search code examples
javaandroidgoogle-glassgoogle-gdk

how to dismiss a static card in Google glass after X seconds?


I'm adding a static card to my google glass timeline.

How can I dismiss this card after 2 seconds?

Is it possible to delay-dismiss even if the activity which created this card has finished already?


Solution

  • You should be able to use a combination of Handler.postDelayed(Runnable, long) and TimelineManager.delete(long)

    Example:

    mHandler.postDelayed(new Runnable() {
        public void run () {
            mTimelineManager.delete(cardId);
        }
    }, 5000);
    

    If you are using a Service then you can do this even after the Activity has finished.