Skip to content
Advertisement

How to convert input type [closed]

I am making timer when user set time and when I want to set time in second “mm:ss”(minutes:seconds) formula my app stops becouse app doesn’t accept colon. So how to convert input type from “mm:ss” to “mmss” that the textview image does not change but in the program changed to the format as I mentioned above

here is my code `

JavaScript

LOGCAT

JavaScript

Advertisement

Answer

For the string to be parseable as long, it must not contain special characters like ":" . A function to convert the time containing “:” to long may look like this :

JavaScript

EDIT: Taking @Joakim Danielson’s comment into consideration, the function is modified as above.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement