I've noticed while trying to switch from one Activity to another within a glass app I've built, the menu seems to get messed up and I get left with a ghost activity displayed in my LiveCard that cannot be closed.
I've reviewed a few of the examples (e.g. Compass) but we don't have any advanced examples for navigation it looks like. Can you help out with defining for me the agreed upon convention thus far for building navigation in apps? This will help fix my issue because I realize I'm creating multiple LiveCards which doesn't seem right.
Activities: Should I create multiple activities or should I recycle the same Activity swapping out the UI instead? If multiple activities, is it a good idea to destroy the previous Activity's service upon loading up a new Activity?
Services: In a broad sense, should there be a single service used by all activities to handle the navigation (switching between Activities)? If just one service, should it ever be stopped/restarted? How do you switch between Activities using the service because we don't have a reference to the service from the Activity or the Binder? Or should there be a service for each Activity to handle the navigation?
LiveCards: I believe only one livecard should be created, so then how do you switch between Activities without creating a new one? Is it the convention to keep a global reference for any service to be able to use this LiveCard?
I've asked a lot of questions and I could be way off base for some of them, but I can use any guidance! I can't really find a good guide on google for defining the expected behavior for nagivation. I come from 3 years as an Android dev, so feel free to be complex in your answers! Thanks guys.
EDIT: In case this helps, here's the code I'm using to go from one Activity to the next:
mLiveCard = new LiveCard(this, GlobalConstants.LIVE_CARD_TAG_ACTIVITY2);
mRenderer = new MainRenderer(this);
mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder()
.addCallback(mRenderer);
// Display the options menu when the live card is tapped.
Intent menuIntent = new Intent(this, Activity2.class);
menuIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
mLiveCard.setAction(PendingIntent.getActivity(this, 0, menuIntent,
0));
mLiveCard.attach(this);
mLiveCard.publish(PublishMode.REVEAL);