Critical current density and resistivity of MgB2 films