• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps I'm not sure how to refresh an activity with new information.

emblemboy

Newbie
I have several textviews in an activity. I then have a button that I want to be able to click that will update the textview.

I want to do this without having to create multiple activities.
How do I go about I guess refreshing the current screen with new information?

I was thinking that using something like TextSwitcher was the answer but I can't really find any good examples of it.
 
The information is coming from the current activity. A method in that class does the calculations and I just want to be able to keep updating the activity with the new calculations whenever a button is pressed.
 
in your onClick() method, just reperform the calculations and then set the text of the TextViews to the new values.
 
Cool that works.

I thought I had tried that before and it didn't work. I think it's because I was telling the button to go to that method in the xml file maybe? Instead of using the onClick() method

I was just doing android:onClick="method"

Or should both of those do the same thing?
 
Hmm.. Odd.. I am not sure why the xml implementation didn't work then. at any rate, I prefer the code implementation anyway.
 
Back
Top Bottom