2

My App widget has a TextView that it's text changes in interaction with user.Now how I can Retrieve Text from it in run time?

Student Student
  • 960
  • 2
  • 14
  • 24

1 Answers1

5

You can't. App widgets are write-only: you can push data to them, but you cannot read them.

Instead, when you update your app widget with new text, you will need to store that text somewhere, perhaps in a file.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • ,Can you represent documentation for your answer?Although your way seems to be practical. – Student Student Jun 10 '12 at 13:40
  • 3
    @StudentStudent: You are welcome to examine the documentation for `AppWidgetManager`, `AppWidgetProvider`, and `RemoteViews` to try to find a getter for your `TextView`. You will fail. I doubt that there is any documentation telling you that there are no such getters, any more than there is documentation telling you that Android apps should not be installed on an elephant (as they will not work and will only serve to annoy the elephant). – CommonsWare Jun 10 '12 at 13:49
  • nice solution thanks, I used a simple static field instead of file with your suggestion – Alireza Jamali Jul 08 '22 at 17:48