• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we add array to shared preference

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to add more than one value as a set.So can we add a array oe array list to shared preference?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read the SharedPreferences API, and also the Editor? You might also want to read this Developers Guide.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i read some where serilize the array and add it ot shared preference .when you get it deserilize.
is this is possible way ?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can't we concatenate the String and add them to Shared preferences?
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both of those ideas are possible. Neither is necessary if you read the API.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below is my code.



i am getting below exception

 
Maneesh Godbole
Saloon Keeper
Posts: 11312
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It doesn't get clearer than that
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to clear all shared preferences.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:how to clear all shared preferences.

So you still don't follow links and read API. Are we supposed to keep repeating ourselves? To what avail?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve.I found it

Editor defaultPrefsPut;
defaultPrefsPut.clear();
defaultPrefsPut.commit();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic