Is there a way to get value from textView item inside widget ? I have a 2 textViews in my widget layout and on my widget update I want to set new value to one of them and I don’t want to change value of the second one. For now when I set value like this
remoteViews.setTextViewText(R.id.text1, newValue");
widgetManager.updateAppWidget(thisWidget, remoteViews);
this is setting value of the second textView to default value defined in layout.
How to get it to not change the value of the second textView, or how to get value to the second textView to be able to adjust to the same ?
It is my understanding that whenever
onUpdateis called, it updates all of the widgets, so what I do is use SharedPreferences, so when I set theTextViewinitially I save the textView text to sharedprefs and then I get the preference when I update. And I do this all within aforloop.Here is my
onUpdate:in my Class M:
I hope that makes sense. Let me know if I need to elaborate on anything.