I'm attempting to removed the deprecated code getWidth();
from this code before going to production. I've tried a few of the ways mentioned here at stack for other classes but cannot seem to get it to work for this. Anyone know i can get the with here?
public class QuickAction extends PopupWindows implements OnDismissListener {
...
public void show (View anchor) {
int screenWidth = mWindowManager.getDefaultDisplay().getWidth();
...
}
I am not sure what have you tried so far, but you could use this:
Like javaDoc says method
display.getWidth()
was deprecated in API level 13 so you should usedisplay.getSize(Point)
instead.In case you don't like "magic" numbers, instead of 13 you can use
android.os.Build.VERSION_CODES.HONEYCOMB_MR2
.