I'm using an android library called Proteus which inflates layouts during run time with a JSON file we have sitting on our server. This library allows for data binding but my question is how can I get data out of these fields while using my app? I can't reference any of the identifiers of the layout because they don't exist during compilation. Is there a way to ignore the error in the statement when (R.id.input) doesn't actually exist until runtime?:
View view = inflater.infalte(R.layout.fragment_form, container, false);
TextView textView = (TextView)view.findViewById(R.id.input);
Or possibly programmatically get a list of all available unique identifiers during runtime? Any info would be helpful. Thank you.
proteus generates view ids at runtime, unlike the
int
ids generated at compile time for Android XML layouts. Unlike Android the IDs of Views created by proteus are based onString
, and theR.id.<something>
will not work.Proteus provides utility methods to find a view by it's
String
id.Layout:
Java:
The returned view can also be a
ProteusView
Please refer to the wiki for more information.