A method for producing coated contact lenses each having a hydrogel coating thereon, comprising the steps of: obtaining a preformed contact lens; forming a base coating on the preformed contact lens according to a solution-coating procedure to form a treated contact lens having the base coating thereon, wherein the solution-coating process comprises contacting the preformed contact lens with a coating solution for a first period of time (t 1) at a first temperature (T 1) of from about 20°C to about 65°C, wherein the coating solution has a first pH and the first temperature (T 1) and comprises from about 0.001 % to about 5.0% by weight of a polyanionic polymer, wherein the polyanionic polymer is a homo- or copolymer of acrylic acid or C 1 -C 3 alkylacrylic acid, wherein the first pH is from 0 to about 4.5; rinsing the treated contact lens obtained in step with water or an aqueous solution having a second pH of from about 6.0 to about 8.0 for a second period of time (t 2) at a second temperature (T 2) which is not higher than the first temperature (T 1); and forming a coated contact lens have a hydrogel coating thereon by contacting the treated contact lens obtained in step with an aqueous reactive coating solution at a third temperature (T 3) of from about 40°C to about 65°C for a third period of time, wherein the aqueous reactive coating solution has a third pH of at least about 9.5 and comprises a water-soluble, thermally-crosslinkable hydrophilic polymeric material having azetidinium groups; wherein the coated silicone hydrogel contact lens having the hydrogel coating thereon can pass Sudan Black staining test after simulated abrasion cycling treatment, the Sudan Black staining test being done by dipping the fully hydrated lens into a solution of Sudan Black dye in a mixture of 80% mineral oil and 20% vitamin E oil, the absence of staining spots on or in the lens indicating an intact coating and the absence of visible fine lines on the lens surface indicating the absence of cracking in the coating. obtaining a preformed contact lens; forming a base coating on the preformed contact lens according to a solution-coating procedure to form a treated contact lens having the base coating thereon, wherein the solution-coating process comprises contacting the preformed contact lens with a coating solution for a first period of time (t 1) at a first temperature (T 1) of from about 20°C to about 65°C, wherein the coating solution has a first pH and the first temperature (T 1) and comprises from about 0.001 % to about 5.0% by weight of a polyanionic polymer, wherein the polyanionic polymer is a homo- or copolymer of acrylic acid or C 1 -C 3 alkylacrylic acid, wherein the first pH is from 0 to about 4.5; rinsing the treated contact lens obtained in step with water or an aqueous solution having a second pH of from about 6.0 to about 8.0 for a second period of time (t 2) at a second temperature (T 2) which is not higher than the first temperature (T 1); and forming a coated contact lens have a hydrogel coating thereon by contacting the treated contact lens obtained in step with an aqueous reactive coating solution at a third temperature (T 3) of from about 40°C to about 65°C for a third period of time, wherein the aqueous reactive coating solution has a third pH of at least about 9.5 and comprises a water-soluble, thermally-crosslinkable hydrophilic polymeric material having azetidinium groups; wherein the coated silicone hydrogel contact lens having the hydrogel coating thereon can pass Sudan Black staining test after simulated abrasion cycling treatment, the Sudan Black staining test being done by dipping the fully hydrated lens into a solution of Sudan Black dye in a mixture of 80% mineral oil and 20% vitamin E oil, the absence of staining spots on or in the lens indicating an intact coating and the absence of visible fine lines on the lens surface indicating the absence of cracking in the coating.