Closed weihaolem closed 5 years ago
Do not use Paper.book().write
and read
functions in UI thread, that may cause the issue.
If you can provide more detailed error message or stacktrace I probably can give more detailed answer.
It is worked after I restart android studio. Maybe the implementation did not start after I add its dependency.
Thank you for your help!
Hi, sorry for asking a question. I would like to ask how to make it works? I have added dependency and initialize Paper, but the function still not working ("write" function do not replace the value of the parameter; "read" function caused the application fail/not working).
This is my class where the value will store:
class Prevalent {
companion object{
val UserPhoneKey : String = "UserPhone"
val UserPasswordKey : String = "UserPassword"
}}
Those is the lines I used Paper library: ->write function
Paper.book().write(Prevalent.UserPhoneKey, phoneNo)
Toast.makeText(this@LoginActivity, "test ${Prevalent.UserPhoneKey} test", Toast.LENGTH_LONG).show()
*Toast show default value instead of showing phone number->read function
val userPhone:String = Paper.book().read(Prevalent.UserPhoneKey)
*tried a lot of times, read function cause application failSorry for my bad English.
Thank you for your help.