linkedin / Spyglass

A library for mentions on Android
Apache License 2.0
387 stars 128 forks source link

How to save it in shared preference for later use #123

Closed NewVengeance closed 3 years ago

NewVengeance commented 3 years ago

I want to save my posts in draft and reuse it for my user don't want to write it again and again

nhibner commented 3 years ago

Hi @NewVengeance,

The library does not take care of this for you, as each application may structure the data differently. In short, you will need to write a function that takes a spanned string and convert that to a data structure that you can persist to shared preferences. The basic gist is to save the text, then save the position and content of each span in the text. For more info, see https://github.com/linkedin/Spyglass/issues/28 (it's a similar question except for sending the data to a server instead of persisting to disk).

Hope that helps!