What is the best practice for naming the id of XML Element in Android?

Viewed 2976

I am not sure if anyone was bugged with this issue before, but it is one big pain for me.

How do you give an id to xml element in android?

Right now, I set the id with the pattern [activity/fragment name][element type][specific name]. For example, if I had an EditText to keep an email which is used in LoginActivity, I will give the id 'LoginEditTextEmail'.

The problem I'm facing is, with this approach, the id often ends up in a very long one.

How do you set the id? What is the best practice?

4 Answers
Related