Android/개발팁
★ setBackground vs setBackgroundDrawable / AlertDialog
hoonihoon
2013. 7. 12. 16:01
It's deprecated but it still works so you could just use it. But if you want to be completly correct, just for the completeness of it... You'd do something like following:
int sdk = android.os.Build.VERSION.SDK_INT;
if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
setBackgroundDrawable();
} else {
setBackground();
}
if (Build.VERSION.SDK_INT > 10)
builder = new AlertDialog.Builder(getActivity(), R.style.Theme.Sherlock.Dialog);
else
builder = new AlertDialog.Builder(getActivity());