if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.M){ if (workStarted){ button.setText(R.string.mainSignOut); button.setBackgroundColor(getResources().getColor(R.color.appRed,null)); button.setTextColor(getResources().getColor(R.color.appWhite,null)); } else{ button.setText(R.string.mainSignIn); button.setBackgroundColor(getResources().getColor(R.color.appGreen,null)); button.setTextColor(getResources().getColor(R.color.appBlack,null)); } } else{ if (workStarted){ button.setText(R.string.mainSignOut); button.setBackgroundColor(getResources().getColor(R.color.appRed)); button.setTextColor(getResources().getColor(R.color.appWhite)); } else{ button.setText(R.string.mainSignIn); button.setBackgroundColor(getResources().getColor(R.color.appGreen)); button.setTextColor(getResources().getColor(R.color.appBlack)); }
Different sdk versions in one app
if you find some deprecated method, and the newest method does not work in your oldest SDK targets use this:
Subscribe to:
Posts (Atom)
No comments:
Post a Comment