Android Question keyvaluestore problem

tufanv

Expert
Licensed User
Longtime User
Hello,

I am using subscriptions in my app. I need to store subscription info for some reason so i decided to use keyvaluestore to store some private data. With the launch of the app i need to check a key with kvs with this code:
Code: Copy
If kvs.GetEncryptedObject("gecerlitarih","password") = "ok"

but at this point, because that there is no subscription purchased by the user, there is no key stored yet as "gecerlitarih" which returns me an error :
Code: Copy
(NullPointerException) java.lang.NullPointerException

How can i fix this?

ty
 
Try a key exist test before kvd.Get...:
Code: Copy
'Tests whether a key is available in the store.
Sub ContainsKey(Key AsString) As Boolean
 
Upvote 0
Back
Top