Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.os.Build; import android.widget.TextView; public class Main { /** * @see android.widget.TextView#setTextAppearance(int id). */ @SuppressWarnings("deprecation") public static void setTextAppearance(TextView view, int id) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { view.setTextAppearance(id); } else { view.setTextAppearance(view.getContext(), id); } } }