tag:blogger.com,1999:blog-7580237816735071324.post6839103127167471336..comments2024-03-27T18:33:08.145-07:00Comments on Android: Set limit for fraction in decimal numbers in EditTextGunaseelan Ahttp://www.blogger.com/profile/01344239526874962371noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-7580237816735071324.post-55593699367428471892020-07-10T04:22:32.577-07:002020-07-10T04:22:32.577-07:00how to achieve validation on input field if amount...how to achieve validation on input field if amount does not have decimal then only allow 5 digit amount but if user entered decimal then allow 8 digit in android using edittextManoj Kadamhttps://www.blogger.com/profile/15176379078376264245noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-75763964720794414482013-06-10T19:21:17.997-07:002013-06-10T19:21:17.997-07:00See the update Brian Choan. By the way trying to t...See the update Brian Choan. By the way trying to toast from setOnKeyListener we will achieve it. From here the toast message will appear from you are enter the last digit. Gunaseelan Ahttps://www.blogger.com/profile/01344239526874962371noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-49988155726076391852013-06-08T22:20:07.608-07:002013-06-08T22:20:07.608-07:00The toast goes off once you have typed the final d...The toast goes off once you have typed the final digit (and if you delete the final digit). I want it to only go off when trying to type past the limit. This way, if the limit is 2 decimal places, and the user is trying to type a third digit, they won't be confused, because they will keep getting a toast saying "You can't go past 2 digits". Right now, it is confusing to the user.Anonymoushttps://www.blogger.com/profile/07713452592638354313noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-74415389801932720952013-06-08T19:09:18.704-07:002013-06-08T19:09:18.704-07:00What about this? This toast also invoked when you ...What about this? This toast also invoked when you reach the limit only. isn't?Gunaseelan Ahttps://www.blogger.com/profile/01344239526874962371noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-11558779120160054662013-06-05T06:51:55.494-07:002013-06-05T06:51:55.494-07:00Thank you for the updates. That is actually what ...Thank you for the updates. That is actually what I thought was supposed to be done as well, but the problem is, that Toast message only executes when you enter the decimal limit and also when you backspace from the limit, NOT when you try to type past the limit. From what I can tell, once you reach the limit, any other keystrokes (except the delete key) are ignored. I have set breakpoints on the entire class. When you reach the limit, and try and type, nothing in the class gets invoked, hence why I can't figure out where to put the Toast message so it works properly :(<br /><br />The idea I am going for is, that if you are typing and the characters go through, then that is fine. But if you have reached the limit, and you are typing and nothing is showing up, I want the Toast message to advise you that you have reached the limit and that is why no more characters are being entered. That way the user doesn't think the app is just broken or something. Does that make sense?Anonymoushttps://www.blogger.com/profile/07713452592638354313noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-55117088121384934402013-06-04T18:39:17.894-07:002013-06-04T18:39:17.894-07:00See the updates friend. I have added toast message...See the updates friend. I have added toast message :)Gunaseelan Ahttps://www.blogger.com/profile/01344239526874962371noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-7869627202415075402013-06-04T13:03:23.108-07:002013-06-04T13:03:23.108-07:00Well that's the thing. I don't see anywhe...Well that's the thing. I don't see anywhere in your class where it triggers a spot I can call it. From what I can tell, after it reaches the decimal size limit, the class doesn't get called again. I don't fully understand the underlying methods, which is why i can't determine how/where to code a toast message for my needs.<br /><br />Where in the class does the code execute when someone tries typing in after they have reached the limit?Anonymoushttps://www.blogger.com/profile/07713452592638354313noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-30914224681626931652013-06-04T09:44:43.030-07:002013-06-04T09:44:43.030-07:00Can you show me your code where you try to call To...Can you show me your code where you try to call Toast message?Gunaseelan Ahttps://www.blogger.com/profile/01344239526874962371noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-85032515166535956402013-06-04T06:38:57.983-07:002013-06-04T06:38:57.983-07:00I have one question. I am trying to create an add...I have one question. I am trying to create an additional constructor for DecimalFilter similiar to this...<br /><br />public DecimalFilter(EditText edittext, String afterTypingMessage) {<br /> et = edittext;<br />}<br /><br />And then would like to be able to call a Toast when the user tries to type past the decimal limit. I can't seem to figure out how to do that.Anonymoushttps://www.blogger.com/profile/07713452592638354313noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-87452889493679005002013-06-03T09:19:06.935-07:002013-06-03T09:19:06.935-07:00you are welcome friend :)you are welcome friend :)Gunaseelan Ahttps://www.blogger.com/profile/01344239526874962371noreply@blogger.comtag:blogger.com,1999:blog-7580237816735071324.post-11674256871403628912013-06-03T08:33:18.324-07:002013-06-03T08:33:18.324-07:00Thank you, this post was EXTREMELY helpful! I hav...Thank you, this post was EXTREMELY helpful! I have added your class to my library. Thanks again.Anonymoushttps://www.blogger.com/profile/07713452592638354313noreply@blogger.com