On my onCreate() method I have the following code
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_item_layout);
final TextView cumItemRating = (TextView) findViewById(R.id.CumItemRating);
final String postText = "(No rating)";
final Handler handler = new Handler();
Thread t = new Thread(){
public void run(){
handler.post(new Runnable(){
public void run(){
cumItemRating.setText(postText);
}
});
}
};
t.start();
addListenerOnRatingBar();
}
On the addListenerOnRatingBar() method, I want to be able to change the cumItemRating.setText(postText) and have it updated every time this method runs.
Declare your TextView as a class/instance variable, initialize it in the onCreate like you are doing now. The TextView will be accessible from everywhere within the activity. You can just call cumItemRating.setText(postText) from there.