
74 So.3d 482 (2011)
Ex parte State of Alabama.
(In re STATE of Alabama v. Corey ARRINGTON).
CR-10-0634.
Court of Criminal Appeals of Alabama.
May 27, 2011.
*483 Luther Strange, atty. gen., and Carrie E. Gray, asst. district atty., for petitioner.
Barr Duane Younker, Jr., Montgomery, for respondent.
PER CURIAM.
The district attorney for the Fifteenth Judicial Circuit filed this petition for a writ of mandamus requesting that we direct Judge William Shashy of the Montgomery Circuit Court to set aside his order granting Corey Arrington's motion for a judgment of acquittal not-withstanding the verdict, to reinstate Arrington's conviction, and to direct that he be sentenced in accordance with that conviction.
In February 2010, Arrington was indicted for violating the Community Notification Act ("the CNA") by failing to notify the Montgomery County Sheriff of his intent to change his address within 30 days of moving, a violation of § 15-20-23, Ala. Code 1975.[1] Before trial, Arrington moved to dismiss the charges against him because, he said, it was impossible for him to comply with the statute in that he had been evicted from his apartment for failing to pay rent. Judge Shashy denied that motion. A jury then convicted Arrington of violating the CNA. Arrington moved for a judgment of acquittal notwithstanding the jury's verdict and argued that the CNA was unconstitutional as applied to him. The State responded that the circuit court was limited by Rule 20.1, Ala. R.Crim. P., to considering only issues involving the sufficiency of the evidence; therefore, it argued, Arrington's motion should be denied. On January 27, 2011, Judge Shashy entered a lengthy order holding that the CNA, as applied to Arrington, was unconstitutional. Judge Shashy also set aside the jury's verdict and dismissed the charges against Arrington. The State objected and moved that *484 Judge Shashy reconsider his ruling.[2] On February 1, 2011, the State filed this timely petition for a writ of mandamus challenging Judge's Shashy's ruling and moved that we stay the proceedings in the lower court.[3] Pursuant to State v. Webber, 892 So.2d 869 (Ala.2004), we granted the State's motion to stay the proceedings pending the resolution of this mandamus petition.
The district attorney argues that Judge Shashy exceeded the scope of Rule 20.3, Ala. R.Crim. P., by setting aside the jury's verdict based on grounds other than the sufficiency of the evidence. It cites this Court's opinion in State v. Grantland, 709 So.2d 1310 (Ala.Crim.App.1997), to support its argument.
Initially, we must determine if a petition for a writ of mandamus is the proper means of attacking Judge Shashy's ruling. Over the past several years, the Alabama Supreme Court has limited the State's right to seek mandamus review. See State v. Martin, 69 So.3d 94 (Ala.2011) (the State may not use mandamus to seek review of discovery ruling in postconviction proceedings unless the State "can demonstrate that an appeal will not provide an adequate remedy"); State v. Murphy, 39 So.3d 1045, 1048-49 (Ala.2009) (the State may not use mandamus to obtain review of a pretrial ruling granting a defendant's motion in limine); Ex parte King, 23 So.3d 77 (Ala.2009) (the State may not use mandamus to seek review of a pretrial ruling denying the State's motion in limine). Nonetheless, the Supreme Court has left undisturbed our holding in State v. Grantland, that the State may use an extraordinary petition for a writ of mandamus to seek review of a circuit court's ruling that the State believes exceeds the scope of Rule 20.3, Ala. R.Crim. P. See also Ex parte Nice, 407 So.2d 874, 876 (Ala.1981). This case is correctly before this Court by way of a petition for a writ of mandamus.
A challenge to the constitutionality of a statute has been described as an "affirmative defense." Jefferson County Comm'n v. Edwards, 49 So.3d 685, 692 (Ala.2010). Rule 15.4(a), Ala. R.Crim. P.,[4] addresses pretrial motions related to defenses and states:
"A motion raising defenses or objections made before trial pursuant to this rule shall be determined before trial, unless the court for good cause orders that it be deferred for determination at the trial on the merits."
The Committee Comments to this rule state the reasons for the adoption of this rule:
"Rule 15.4 requires that the pre-trial motion be determined by the court before trial, unless deferred for good cause until the trial. When the motion raises an issue better determined during the trial, it would be proper to defer the *485 motion. For example, the question of venue may be `[one of] fact so entwined with the merits ... that a decision should not be made before trial but postponed until trial.' United States v. Callahan, 300 F.Supp. 519, 522 (S.D.N.Y. 1969). In Callahan, the defendants were charged with a conspiracy, and venue was allegedly based on the planning having been done in the county of trial. To prove venue, the planning of the crime would have to be shown. A ruling on the motion was properly deferred until the trial.
"On the other hand, the motion may raise only questions of law which would properly be decided by the court. The purpose of this rule is to dispose of defenses which may be determinative of the case, but which do not require a trial on the merits. Such determinations will reduce the expense of trial and, in appropriate cases, will permit the state a right of appeal under Rule 15.7; thus trial judges should determine pre-trial motions in advance of trial in all possible instances.
"This rule allows the judge to decide all issues of fact raised by the motion, which are not constitutionally required to be tried by a jury. Examples of such facts would be the waiver of constitutional rights, legality of searches, the presence of unauthorized persons in the grand jury room, and discrimination in the selection of the grand jurors. See United States v. Smyth, 104 F.Supp. 279 (N.D.Cal.1952), Shafer v. State, 214 Tenn. 416, 381 S.W.2d 254 (1964). See also Pate v. Robinson, 383 U.S. 375, 86 S.Ct. 836, 15 L.Ed.2d 815 (1966), requiring a hearing on the question of competence to stand trial when that issue is raised by the evidence presented at trial."
Rule 15.4, Ala. R.Crim. P., contemplates that a motion challenging the constitutionality of a statute be made and disposed of before trial. At that time, if the court finds a statute unconstitutional and dismisses the charges against a defendant, as was the situation in this case, the State has a remedy: It may file a pretrial appeal pursuant to Rule 15.7, Ala. R.Crim. P.[5] However, once jeopardy has attached, the State no longer has a right to appeal. See State v. Maddox, 828 So.2d 946 (Ala.Crim. App.2001).
The Alabama Supreme Court has recognized that a Rule 15, Ala. R.Crim. P., motion may be disposed of after a verdict is entered if the court elected to take the motion under advisement. See Ex parte Dunn, 8 So.3d 935 (Ala.2008). In Dunn, the Supreme Court held that a circuit court had the authority to grant a motion to suppress and to set aside the jury's guilty verdict because, it said, the court had specifically taken the motion to suppress under advisement without objection from the State.[6] Here, the documents filed with this petition do not show that the *486 court took the constitutionality of the CNA under advisement with the consent of the State. In fact, it appears that Arrington did specifically challenge the constitutionality of the CNA until he filed his motion for a judgment of acquittal notwithstanding the jury's verdict.[7] Arrington's pretrial motion to dismiss merely stated the following:
"On or about 11th of October 2009, the defendant was involuntarily and unexpectedly evicted for failure to pay rent (the defendant was, and is, unemployed) from the Peddler's Inn, located at 4231 Mobile Highway, Montgomery, Alabama, his then-assigned and approved residence.
"Given the circumstances it was impossible for the defendant to comply with the statute."
Once a jury verdict has been entered, a circuit court may set aside that verdict and vacate the charges only for the reasons set out in Rule 20.3, Ala. R.Crim. P. Rule 20.3, states in pertinent part: "After a verdict or the entry of a judgment of conviction, the defendant may move for a judgment of acquittal, or the court, on its own motion, may grant a judgment of acquittal." Rule 20.1, Ala. R.Crim. P., lists the grounds which will support the motion:
"The court, on motion of the defendant stating the grounds therefor, or on its own motion, shall direct the entry of a judgment of acquittal as to any charged offense, or as to any lesser included offense, for which the evidence is insufficient to support a finding of guilty beyond a reasonable doubt."
(Emphasis added.)
This Court in Grantland, in construing the scope of Rule 20.3, Ala. R.Crim. P., stated:
"Although Rule 20.3, Ala. R.Crim. P., clearly authorizes a trial judge to grant a motion for a judgment of acquittal after the jury has returned a guilty verdict, that rule does not permit a judge to enter a judgment of acquittal on grounds other than those provided for under Rule 20 generally. A motion for a judgment of acquittal tests the legal sufficiency of the evidence. Suttles v. State, 574 So.2d 1012 (Ala.Cr.App.1990); Metzger v. State, 565 So.2d 291 (Ala.Cr. App.1990); see, generally, Committee Comments, Rule 20.1, Ala. R.Crim. P. When presented with a challenge to the sufficiency of the evidence, the trial court, and any reviewing court, must accept the evidence presented by the state as true, must view that evidence in a light most favorable to the state, and must accord the state all legitimate inferences from the evidence. Rowe v. State, 662 So.2d 1227 (Ala.Cr.App.1995). Where there is legal evidence from which a jury could by fair inference find a defendant guilty, a trial judge should submit the case to the jury. Id. Moreover, where there is sufficient legal evidence to submit the case to the jury and the jury has considered that evidence and rendered its verdict, it is not proper for the trial court, or a reviewing court, to substitute its judgment for that of the jury. Winters v. State, 673 So.2d 786 *487 (Ala.Cr.App.1995); Rowe, 662 So.2d 1227. It is not the function of the court to assess the credibility of witnesses, weigh the evidence, or substitute its judgment as to guilt or innocence for that of the jury. Porter v. State, 666 So.2d 106 (Ala.Cr.App.1995)."
709 So.2d at 1311-12.
Here, in granting Arrington's motion for a judgment of acquittal notwithstanding the verdict, the circuit court specifically found that § 15-20-23, Ala.Code 1975, was impermissibly vague, and that, as applied to Arrington, it violated the Due Process and the Equal Protection Clauses of the United States and Alabama Constitutions.[8] The circuit court's ruling did not address the sufficiency of the evidence to convict Arrington; thus, it exceeded the scope of Rule 20.3, Ala. R.Crim. P.
Accordingly, we grant the State's petition for a writ of mandamus and direct the circuit court to reinstate the jury's guilty verdict and to sentence Arrington in accordance with the law.[9]
PETITION GRANTED; WRIT ISSUED; STAY LIFTED.
WELCH, P.J., and WINDOM, KELLUM, BURKE, and JOINER, JJ., concur.
NOTES
[1]  Section 15-20-23, Ala.Code 1975, states, in pertinent part:

"If an adult criminal sex offender intends to transfer his or her residence to a different location, he or she shall submit a notice of intent to move to the sheriff of the county and the chief of police of the municipality in which he or she resides, and to the sheriff of the county and chief of police of the municipality to which he or she plans to move, if such are different, at least 30 days prior to moving to the new location."
[2]  A motion to reconsider does not toll the State's time for filing a petition for a writ of mandamus. See Ex parte Sharp, 893 So.2d 571 (Ala.2003); Ex parte Thomas, 828 So.2d 952, 954 (Ala.2001); Ex parte Troutman Sanders, LLP, 866 So.2d 547 (Ala.2003).
[3]  An extraordinary petition must be filed within a presumptively reasonable time period. See Rule 21(a), Ala. R.App. P. The Alabama Supreme Court has held that in a criminal case the State has only seven days to file a timely petition for a writ of mandamus. See Rule 15.7(b), Ala. R.Crim. P.; Ex parte Sharp, 893 So.2d 571, 575 (Ala.2003).
[4]  This rule was adopted by the Alabama Supreme Court pursuant to the rule-making authority granted it by Art. VI, § 150, Ala. Const. 1901 (Off.Recomp.) (Added by Amendment No. 328, § 6.11, Ala. Const.1901).
[5]  Rule 15.7, Ala. R.Crim. P., states, in pertinent part:

"In any case involving a felony, a misdemeanor, or a violation, an appeal may be taken by the state to the Court of Criminal Appeals from a pre-trial order of the circuit court (1) suppressing a confession or admission or other evidence, (2) dismissing an indictment, information, or complaint (or any part of an indictment, information, or complaint), or (3) quashing an arrest or search warrant."
[6]  Rule 15.3, Ala. R.Crim. P., states: "(a) Pretrial motions. A motion under Rule 15.2 must be made: (1) In circuit court at or before arraignment or by such later date as may be set by the court...."
[7]  We have stated:

"[The constitutionality of the statute] is not properly before this Court because it was raised for the first time in Greer's posttrial motion for a judgment of acquittal or, in the alternative, a new trial. A constitutional challenge to the regularity of proceedings preliminary to trial must be timely and is waived if raised for the first time in a posttrial motion. See DeFries [v. State], 597 So.2d [742] at 747 [(Ala.Crim.App.1992)]."
Webster v. State, 900 So.2d 460, 472 (Ala. Crim.App.2004), rev'd on other grounds, Ex parte Stewart, 900 So.2d 475 (Ala.2004).
[8]  This Court recently held that the prior version of § 15-20-22(a), Ala.Code 1975, which required an inmate to furnish the Department of Corrections an actual address "at which he or she will reside" within 45 days of his release from prison, was unconstitutional as applied to the defendant, a homeless individual. See State v. Adams, [Ms. CR-08-1728, November 5, 2010] ___ So.3d ___ (Ala.Crim. App.2010). We also stated: "We do not hold that § 15-20-22(a)(1) always operates unconstitutionally or that there are no set of circumstances under which the statute would be valid." ___ So.3d at ___. See also McKenzie v. State, [Ms. CR-09-1451, December 17, 2010] ___ So.3d ___ (Ala.Crim.App.2010); Reese v. Oliver, 66 So.3d 289 (Ala.Crim. App.2010). In this case, it appears that after Arrington was evicted he moved in with his mother.

Section 15-20-22(a), Ala.Code 1975, was amended effective May 21, 2009, to change the number of days from 45 to 180 and to state that the adult sexual offender must provide the "actual physical address" to the DOC. This Court in Reese v. Oliver, addressed the constitutionality of the current version of § 15-20-22(a), Ala.Code 1975.
[9]  Rule 26.2(b), Ala. R.Crim. P., states:

"Upon a determination of guilt on any charge, or on any count or any charge, judgment pertaining to that count or to that charge shall be pronounced and entered together with the sentence. Pronouncement of judgment may be delayed if necessary until such time as sentence can be pronounced."
(Emphasis added.)
