Skip to content

Commit 31d543b

Browse files
Create final SimpleDateFormat instance only when creating ExpiryWatcher instance
1 parent 0a36511 commit 31d543b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

raveandroid/src/main/java/com/flutterwave/raveandroid/card/CardFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,12 @@ public void onPageFinished(WebView view, String url) {
835835
private class ExpiryWatcher implements TextWatcher {
836836

837837
private final Calendar calendar;
838+
private final SimpleDateFormat simpleDateFormat;
838839
private String lastInput = "";
839840

840841
public ExpiryWatcher() {
841842
calendar = Calendar.getInstance();
843+
simpleDateFormat = new SimpleDateFormat("MM/yy");
842844
}
843845

844846
@Override
@@ -854,7 +856,6 @@ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
854856
@Override
855857
public void afterTextChanged(Editable editable) {
856858
String input = editable.toString();
857-
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/yy");
858859

859860
try {
860861
calendar.setTime(simpleDateFormat.parse(input));

0 commit comments

Comments
 (0)