android - How to know a user as moved to a new Card in a Google Glass app? -
is there way cardscrollview or cardscrolladapter let me know when user moves 1 card another?
initially using gesturedetector detect swipes left or right, in glass applications users can use, e.g., two-finger swipes pan , move distant card (or voice controls).
there must better way know when new card displayed track these directional events.
i know cardscrollview.getselecteditemposition() gives me current card in view, not when new card displayed.
i thought cardscrolladapter.getview() run every time new card displayed, in glass applications runs once in beginning of activity execution.
any great.
my glass somewhere in storage can't test can try ondetachedtowindow , onattachedtowindow. this:
private view buildview() { cardbuilder card = new cardbuilder(this, cardbuilder.layout.text); card.settext(r.string.whatever); view view = card.getview(); view.addonattachstatechangelistener(new view.onattachstatechangelistener() { @override public void onviewattachedtowindow(view v) { } @override public void onviewdetachedfromwindow(view v) { } }); return view; }
also card lifecycle might give idea.
Comments
Post a Comment