3

How the string representation of InputType in xml layout is converted to integer values in code? For example in xml layout this assignment

android:inputType="number"

will be converted to

InputType.TYPE_CLASS_NUMBER

I cannot find the conversion function.

Actually the story is as follows:

I am creating a new component containing some other components including an EditText. In attr.xml I have created some new attributes. I am going to add InputType to the new component and assign its value to the inner EditText. InputType data type is an Integer. But in attr.xml it must be defined to be able to accept the values such as "number" or "text" or etc.

In android source code (here) I found this, but it doen't help:

int inputType = EditorInfo.TYPE_NULL;
switch (attr) {
    case com.android.internal.R.styleable.TextView_inputType:
        inputType = a.getInt(attr, EditorInfo.TYPE_NULL);
        break;

Actually I need the attr.xml for EditText component of android

mehrdad seyrafi
  • 3,084
  • 2
  • 19
  • 16

0 Answers0