In order to get rid of such deprecation warnings, when providing backwards compatibility,
one has to remove the import
, to which one cannot apply @SuppressWarnings("deprecation")
:
// import android.net.NetworkInfo;
And then use it's fully qualified class name android.net.NetworkInfo
instead of NetworkInfo
. The point is, that one can only apply @SuppressWarnings("deprecation")
to methods, but not imports.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…