Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Android's SharedPreferences equivalent in Java?

I'm trying to port an Android application to a Java desktop application. The android application is using a SharedPreferences object to store some data. Is there an equivalent in Java of this class?

like image 527
Andrei Avatar asked Apr 27 '16 13:04

Andrei


2 Answers

Check the Preferences API out. It has the same idea and use cases as the SharedPreferences.

like image 189
Danail Alexiev Avatar answered Sep 23 '22 22:09

Danail Alexiev


Check out the java.util.Properties class.

You have to manage reading and writing the file, but it might be good enough!

like image 43
Jamie Avatar answered Sep 23 '22 22:09

Jamie