Getting Style Name of a specific view - Android

android, styles

Solution

I'm afraid you can't. Looking at the view constructor (in particular ), the style is used just to define view's properties but it's thrown away afterwards. It is not stored anywhere, so I guess you can't retrieve it from the view object.

If you need to get the style you can still (conventionally) add a tag to the views and behave according to that.

Problem

I have an EditText and a custom Style, and I would like to know how I can programmatically, get the "name" of this style, like below: ``` <EditText android:id="@+id/idValue" style="@style/integerNumber" ... /> ``` In the code, ``` EditText edValue = findViewById (R.id.idValue); ``` In this case, I need to receive "integerNumber". Is there a specific method to get this information? (such as edValue.getResources().getStyle()) ... I could not find at all.

Original source