Using the Google Glass GDK, I'm trying to put together a simple app that displays / updates a live card. In my Service, I have the following method:
private void publishCard(Context context) {
Card updatedCard = new Card(context);
updatedCard.setText("Foo");
updatedCard.setInfo("Bar");
RemoteViews cardViews = updatedCard.toRemoteViews();
if (cardViews == null)
Log.e(TAG, "Appears to happen every time!")
// Then do some other stuff that fails because of a null RemoteViews
}
As you can see above, the null check seems to fail every time. Any idea why that might be?
My thought is that I'm calling this and passing in a Service as the context rather than an Activity, and maybe you're not supposed to do that? If that were the case, though, how would you be able to update a Live Card? I am capable of constructing a RemoteViews from an XML, but being able to use a Card would simplify things a lot.