I'm trying to get a String from SavedPreferences and put it's contents into a Spanned class so it can be displayed in an EditText field using Html markup. I have pasted my current code below however I see why it doesn't work as a String and Spanned are not the same types...does anyone know of a good way around this?
public class SavedItemsActivity extends ItemsActivity {
private static SharedPreferences saveditems;
@Override
public Spanned getItem() {
Spanned item = null;
item = Html.fromHtml(saveditems.getString("CurrentSavedItem",""));
return item;
}
I am unable to pass the string to the EditText directly. I tried using the below code (where 'itemtext' is the EditText):
ItemGenActivity.itemtext.setText(Html.fromHtml(saveditemss.getString("CurrentSavedItem",""));
The EditText is declared in the other ItemGenActivity as below:
public EditText itemtext
You cannot modify
ItemGenActivity
from another activity.ItemGenActivity
can load theSharedPreferences
and apply the value to its ownEditText
.