-1

There are many examples exist for validating full number but Could anybody help me how can I start for pre-guessing Credit Card validation while typing the number itself digit by digit (at least after entering 4 digit), not a full complete number in Java?

PS: Question is not duplicate, Full number validation answers exist but my requirement is after entering 4 digits. Thanks

Neelam Verma
  • 3,232
  • 1
  • 22
  • 33

1 Answers1

2

dbachelder/CreditCardEntry and vinaygaba/CreditCardView and sharish/CreditCardView on github have pretty good implementations to follow.

dbachelder/CreditCardEntry is one of the examples of how to implement some of the regex needed to pre-guess the card type. Just remember to validate the full-card number with luhn algorithm before accepting it. FreeFormatter site has some good information on how to validate a credit card number. In any case, the card has to be validated with a payment processor before you can be certain that it is a valid card number.

Good luck !

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
pellucide
  • 3,407
  • 2
  • 22
  • 25
  • Thanks a lot :) That what I needed to look into! I don't understand y ppl are downvoting my question. – Neelam Verma Oct 17 '17 at 02:33
  • 1
    The downvotes are probably due to the fact that, a simple github/stackoverflow search would have saved you a ton of time in typing this question. But I think it would have been a good idea to let you know that this is just a simple search – pellucide Oct 17 '17 at 02:37
  • Thanks, Maybe Anyways I am new to Android and Java! – Neelam Verma Oct 17 '17 at 02:40
  • @Neelam Personally, I downvoted because you asked us to "help you with the logic", yet included no logic in the question for anyone to help you with – OneCricketeer Oct 17 '17 at 13:19
  • @cricket_007: Thanks Appreciated, will take care in future! anyways updated the question! – Neelam Verma Oct 17 '17 at 14:07