Atlas91
Atlas91

Reputation: 5904

Refresh a textview when click a radio button Android

I need to refresh a texview when i click a radio button. My textview contains the free memory info and i want that when i click the radio button i use to clear the RAM cache the textview refreshes and so i can see in that moment the free RAM without exit the application and enter it again.I found this example

TextView tv = (TextView) view.findViewById(R.id.lastRefreshed);
tv.setText("Blah: " + time);
view.invalidate();  // for refreshment

Is it possible? Thanks

Upvotes: 1

Views: 939

Answers (1)

Jainendra
Jainendra

Reputation: 25143

You can register click event for radio-button.

 RadioButton rb = (RadioButton)findViewById(R.id.radioButton1);
 rb.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        // refresh the textview here
    }
});

Upvotes: 2

Related Questions