Changing an Activity's TextView in a BroadcastReceiver (Android) -


I have a simple Android app with a single activity, including textview. I created a broadcast receiver whose purpose is to make a few numerical calculations, convert the result to string, and then change the text value of textView into that string. However, because the activity of the app is not present when the Broadcast receiver is usually called, so I can not find the textview of the activity (I can not always find a way to find a way to get a null pointer exception).

I have read other articles on stack overflow that suggest a listener with a callback method for my broadcast receiver, but I honestly do not make sure how to Implement. I am aware of the concept of callback method, I just do not know how to implement it in this context. Can someone suggest how I can accomplish this? Thanks!

edit

Asinka Task will be done to take action in the background.

Note that you will have to pass your TextView to its creator inside AsyncTask

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -