I know how to create a custom style attribute definition and get the value in a custom view (from this link):
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyCustomView, defStyle, 0);
String str = a.getString(R.styleable.MyCustomView_my_custom_attribute);
But I´m wondering if it´s possible to define a "global" tag that I can apply to any view, either custom or from Android SDK.
Let´s say I want to execute a static method to the views containing that attribute, but avoiding any reference to the view (like FindViewById):
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
whatever:custom_global_tag="key" />
MyStaticClass.Process(View view, String key) {}
Is this even possible?
Edit
Just to clarify, what I really need is a string. The goal is transforming an string into another and assign the new value to the text property.
My env is Xamarin but any native approach could be translated to Xamarin so all suggestions are welcome