Technology

Code Style with Android

Published on · By The Smart Innovator™ Staff

Introduction

Android is a big platform nowadays and cover almost all segments of society. We can see a variety of products based on the Android platform like Smartphones, Smart Watches and Smart TV, etc. Android is really growing up from cupcake to Android O we gone really intensive open source approach. So we brings Code Style with Android for our readers.

It makes Android very rich in a way of many developers from all over the world contribute their expertise and solve the bugs before the launch of the new version of Android. Many developers contribute in recently development process of Nought and now in Android O.

Exceptions

It can be really painful to ignore exceptions in your code. The code with better exception handling is more stable than without it. You must handle every exception in a principled way,specific cases may want extra code. Don’t catch the generic exception like IO exception, NullPointer exception and ArrayOutOfBound exception instead of these use generic Exception. You can later check what is the specific error by catching the error in that block.

Javadoc Standard Comments

Every file should have Javadoc Standard Comments it can have a copyright declaration, class or interface description. Every method should be well described about what this method can do, what is the its main function. Define fields in Standard places like at the top of the file or immediately before the method declaration.

Set the scope of variable in Code Style with Android

Keeping the scope of variable minimum makes code more readable, maintainable and less error prone. Local variables should declare where they first use.

Follow Variable Naming Conventions

1.Non public and non static fields  start with m.

2.Static fields names start with s.

3.Other field start with s.

4.Public static final fields and constant are ALL_CAPS_WITH_UNDERSCORES.

Use standard braces Style like this

class Sample {
    void method() {
        if (condition) {
            // ...
        }else {
            // ...
        }
    }
}

Each line of text in code should be at most 100 character long.

Use Standard Java Annotations

  • @Override: The @Override annotation must be used whenever a method overrides the declaration or implementation from a super-class. For example, in Android onCreate() method define the parent view of the activity so we override this method with annotation @override..
  • @SuppressWarnings: The @SuppressWarnings annotation should be used only under circumstances where it is impossible to eliminate a warning. If a warning passes this “impossible to eliminate” test, the @SuppressWarnings annotation must be used, so as to ensure that all warnings reflect actual problems in the code.

Code Style with Android Verdict

The Code should be robust and scale-able, it also consists uniform standard throughout the code structure. It will help the development team to easily understand what is the motive of a particular line of code. Stay tuned for more such articles only on The Smart Innovator.

The Smart Innovator™ Staff

The Smart Innovator™ Staff covers the latest breakthroughs in technology, AI, startups, and digital innovation. Our editorial team curates global trends, product launches, and insightful analyses to help readers stay ahead in the fast-changing world of tech. We blend research, industry expertise, and creativity to spotlight ideas shaping the future.

Recent Posts

Garmin Fenix 9: Built for More Than Your Fitness Adventure Partner

Garmin has officially launched the Fenix 9, and this time the company's flagship adventure watch…

August 26, 2026

Android Pulse: Google’s Hidden Android App on Millions of Phones

There is a Google app sitting on millions of Android phones that most users have…

August 24, 2026

Infinix Hot 70 Pro 5G: Tiny Rear Display With More To Do

The Infinix Hot 70 Pro 5G has one feature that immediately makes it look different…

August 22, 2026

Nothing OS 5.0 Is About to Change the Nothing Phone Experience

Nothing is getting ready for one of its biggest software updates yet. Nothing OS 5.0…

August 20, 2026

Firefox Smart Window Is Turning Your Browser Into AI Workspace

Firefox is taking a different approach to the AI browser race. Instead of turning every…

August 18, 2026

AI Food Order: Google Maps Wants Gemini to Order Food for You

Google Maps is becoming much more than a navigation app. With its latest Ask Maps…

August 16, 2026

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.

Read More