The below code compiles when included in the main activity of a B4A project. But when added to a B4A class it complains about getResources(); How do I get around this?
B4X:
public int dp2px(int dip) {
Resources resources = getResources();
int px = Math
.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
dip, resources.getDisplayMetrics()));
return px;
}