I want to know about best practice for this SplashScreen class:public class SplashScreen extends Activity {    // time out to splash screen    private static int SPLASH_TIME_OUT = 2000;    private Runnable mjumpRunnable;    private Handler mHandler;    //image view to validae logo    ImageView validatelogo;    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.splashscreen);        validatelogo = (ImageView) findViewById(R.id.imgvalidatelogo);        validatelogo.setVisibility(View.VISIBLE);        final Animation fadeouteffect = AnimationUtils.loadAnimation(this , R.anim.fadein);        validatelogo.setAnimation(fadeouteffect);        mjumpRunnable = new Runnable() {            @Override            public void run() {                jump();            }        };        mHandler = new Handler();        mHandler.postDelayed(mjumpRunnable , SPLASH_TIME_OUT);    }    @Override    public boolean onTouchEvent(MotionEvent event) {        if(event.getAction() == MotionEvent.ACTION_DOWN){            jump();        }        return super.onTouchEvent(event);    }     void jump(){        if(isFinishing())            return;        startActivity(new Intent(this , LoginActivity.class));         finish();    }}
SplashScreen class
java;android
So you want to follow good practices. There are quite a few things to pick on here.Limit access as much as possibleTry to make member fields private first, and relax access as needed.For example, why isn't this variable private?ImageView validatelogo;Aim for immutabilityImmutable things are easy to work with:as they never change,there is no window of vulnerability,you can trust immutable things from the time they are constructed forever.Even if true immutability is not achievable,it's good to take steps in that direction.A good first step is to try to make member fields final.For example, these variables could easily be final:private static int SPLASH_TIME_OUT = 2000;private Handler mHandler;Limit scope as much as possibleBy limiting the scope where a variable is visible,you make the variable easier to understand,and reduce the probability of accidental modifications.For example, these member variables are only used inside one method, onCreate,so they should be declared there (converting to local variables from members):    private Runnable mjumpRunnable;    private Handler mHandler;    ImageView validatelogo;NamingmjumpRunnable doesn't conform to Android naming conventions,it should be mJumpRunnable (with capitalized J).LayoutThere are many pointless blank lines,especially at the end of onCreate.FormattingThere are multiple formatting issues here:     void jump(){        if(isFinishing())            return;        startActivity(new Intent(this , LoginActivity.class));         finish();    }That is:Inconsistent indentationIt's recommended to use braces always, even with single-statement ifThere should be a space between ){ in jump(){There shouldn't be a space before the comma in this ,