I am going to implement a LinearLayout
in which the input fields are programmatically generated according to the number of fields of the database table.
Unf
Use like this. It will work.
textView.setTextAppearance(this, android.R.style.TextAppearance_Large);
Or, since API 23, you don't need to pass a context. Hence, you can simply call:
textView.setTextAppearance(android.R.style.TextAppearance_Large);
If you want to support API 23 or higher as well as lower one, you can use the below method to simplify your task. Use the below method only if you are already targeting API 23 or higher. If you are targeting API is less than 23, the below code will give error as the new method wasn't available in it.
public void setTextAppearance(Context context, int resId) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
super.setTextAppearance(context, resId);
} else {
super.setTextAppearance(resId);
}
}