Search code examples
androidandroid-fragmentsandroid-activity

(android) How to name an Activity, Fragment..etc


This is not a code question.

I was just naming a Fragment and it got so long that I got confused.

I'm not sure if the Fragment's name is appropriate because it's too long.

What is the right way to name Activity or Fragment?

When naming, does the word Fragment or Activity have to be included?

For example, MovieListFragment -> MovieList, MovieActivity -> Movie

It's because sometimes it gets too long if i include these.

Or does it matter if I include it and it's long?

There are more than 22 letters to make it easier to recognize the Fragment I'm trying to name.


Solution

  • It all depends on what you and your team are most comfortable with. It does not matter if the name becomes too long or too short. I always name my project files keeping in mind that if I come back to my project after few months I should not be confused with file names and it is pretty intuitive.