I am using layout rendering (as opposed to bitmap rendering) in my Smarteyeglass app. How can I get a reference to the current view?
I would like to rotate one ImageView in my layout according to a value calculated in code. So I need to do something like this:
ViewGroup view = <GET THE VIEW HERE>
RelativeLayout relativeLayout = (RelativeLayout) RelativeLayout.inflate(context,
currentLayout, view);
relativeLayout.findViewById(R.id.my_view_object).setRotation(20);
But the problem is that I can't find a way to get a reference to a root view.
I am using the following code to display my layout:
Intent intent = new Intent(Control.Intents.CONTROL_PROCESS_LAYOUT_INTENT);
intent.putExtra(Control.Intents.EXTRA_DATA_XML_LAYOUT, R.layout.my_layout_id);
sendToHostApp(intent);
Which doesn't return a reference to the view.
Unfortunately, you can not dynamically access to view elements in the layout. Because layout is sent to SmartEyeglass statically once you use the showLayout method or sendToHostApp method.
If you would like to make any detailed changes in your view elements, you need to send complete layout again.
But if you are trying to make changes in text or image content in your view elements, you can use sendText and sendImage methods.