View.setPadding accepts only in px, is there anyway to setPadding in dp?

Straight to code

int padding_in_dp = 6;  // 6 dps
final float scale = getResources().getDisplayMetrics().density;
int padding_in_px = (int) (padding_in_dp * scale + 0.5f);

If you define the dimension (in dp or whatever) in an XML file (which is better anyway, at least in most cases), you can get the pixel value of it using this code:

context.getResources().getDimensionPixelSize(R.dimen.your_dimension_name)

There is a better way to convert value to dp programmatically:

int value = 200;
int dpValue = (int) TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP,
            value,        
            context.getResources().getDisplayMetrics());

Then apply dpValue to your method, for example: setPadding(dpValue,dpValue,dpValue,dpValue);