I'm new in Kotlin, i want to create an android mobile app.I use Android studio 3.3,the Android API level 28. I have used a swagger to get all my RESTful web service, thus, i have the android-client-generated the file that contains all the web service. As a start, I created an android interface for authentication with Email and Password". Among the web service available, "apiMobileUsersGetByFireBaseIDGet". This Ws, use the firebase Id to authenticate.
I create a kotlin class AUthentication as the following :
i added alse the internet permission in the AndroidManifest.xml. My problem is when i run my app in my mobile phone, a "NetworkOnMainThreadException" sets off.I tried for several times to correct this error.I'm really stuck. The error description as the following :
If that generates code that uses "sun.*" classes then it is VERY old. Replace it with something newer. Java has had time and calendar classes built in for a long time. If you can't use java.time (which on Android 6 you can't) then use java.util. Calendar.
posted 3 weeks ago
I would like to thank you for your reply first of all.
The date.class is deprecated, how can i change it
I've already mentioned that you can't use java.time on Android below API 26. If you're unfamiliar with Date and/or Calendar, then there is no shortage of tutorials for those out there on the web. If you have a specific question about them, start a new topic in the Java in General forum, as that has nothing to do with Android.