sil
sil

Reputation: 483

Android: Redrawing a specific view inside a layout

I have a vertically aligned LinearLayout which contains a TextView, my own custom view class, and i'm hoping to put an ad at the bottom.

I'm drawing objects in my custom view class (that extends View), but it does not get updated to the screen unless i call setContentView(R.layout.myview), but this resets my TextView to the default text (what is stored in the xml file) which i don't want, and i assume it would redraw a new ad as well... annoying.

Is there a way i can redraw/refresh my custom View to the screen without affecting my textview or whatever else i may have on my layout?

Upvotes: 5

Views: 10528

Answers (1)

trojanfoe
trojanfoe

Reputation: 122468

How about View.invalidate()?

From the reference:

Note that the framework will not draw views that are not in the invalid region.

To force a view to draw, call invalidate().

Upvotes: 4

Related Questions