I have an Activity
that accepts voice input, instantiates a Card
and then responds to an onClick
event. When the onClick
fires off, I want redirect the use back to the "OK Glass" view or the timeline containing a historical card representing that action. I can't seem to find any obvious way to do this...
Asked
Active
Viewed 86 times
0

Ryan
- 808
- 7
- 11
1 Answers
2
In a live card, you can call:
finish();
to return to the home screen (OK Glass).
I tested this on XE16 and it worked.
Here is some more detailed code from my Activity:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
{
//return to OK Glass screen
finish();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
If you provide some code to make your question more specific I can provide more specific guidance.

Mark Scheel
- 2,963
- 1
- 20
- 23
-
You gave me exactly what I was looking for; is this in the guide anywhere? – Ryan Apr 22 '14 at 15:06
-
It's an Android lifecycle thing, a guess on my part from past Android experience. Generally Glass behaves like Android, but there are exceptions, so I generally trust but verify like I did in this case. Here is a reference for you: http://developer.android.com/training/basics/activity-lifecycle/index.html – Mark Scheel Apr 22 '14 at 23:15