Is using System Hungarian Notation for Android UI components (Views) valid? I mean using it ONLY for Views - no strSomething, boolStuff or similar names.

For example, tvDescription (TextView), editUsername or txtUsername (EditText), btnSubmit (Button), etc.

Especially with Buttons, because btnStartCountdown seems better than "startCountdown" - it sounds like a function (minus the parentheses), and it's difficult to know that it's a Button by its name alone.


“Hungarian notation” can be useful to include additional information in the variable name, when that information cannot be represented in the type system. However, Systems Hungarian is entirely pointless and merely duplicates information that is already available. Most occurrences of Systems Hungarian are legacy code, or a misunderstanding of the benefits of Hungarian notation.

For example, I might use a variable like startCountdownButton in untyped languages like Python, but probably not in statically typed languages like Java. Depending on your architecture (like MVC, MVVM), there is also unlikely to be confusion between a button and an action because they aren't part of the same object.

Nevertheless, if you find that including a prefix or suffix in your variable names makes them clearer in the context of your code, then go for it. There are many opinions on whether or not to use Hungarian notation, and some of them are phrased very strongly (you should never do this, always do that). But they are just opinions and guidelines, no strict laws. Do what makes sense for your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.