'Text 'null' could not be parsed at index 0 error
i used threeten and Google Play console says my code only occurs in Samsung s9 and s20. here is my error and my code
Error Message
org.threeten.bp.format.DateTimeParseException: Text 'null' could not be parsed at index 0
FATAL EXCEPTION: Thread-3
Process: com.playhead.timbre, PID: 20573
org.threeten.bp.format.DateTimeParseException: Text 'null' could not be parsed at index 0
at org.threeten.bp.format.DateTimeFormatter.parseToBuilder(DateTimeFormatter.java:1588)
at org.threeten.bp.format.DateTimeFormatter.parse(DateTimeFormatter.java:1491)
at org.threeten.bp.LocalDateTime.parse(LocalDateTime.java:444)
at com.playhead.timbre.Function.localTime(Function.java:581)
at com.playhead.timbre.Feed.Feed_Main.TimeOutRefresh(Feed_Main.java:229)
at com.playhead.timbre.Feed.Feed_Frame.onHiddenChanged(Feed_Frame.java:91)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:374)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
My Code [Function.Class]
public static boolean localTime(String timeout){ //timeout = "2022-02-20 18:20:36"
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime serverDate = LocalDateTime.parse(timeout, formatter); //<< Function.java:581
org.threeten.bp.LocalDateTime localDate = org.threeten.bp.LocalDateTime.now();
Log.e("LocalTime", "server:" + serverDate + " local:" + localDate);
return localDate.isAfter(serverDate);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
