Android: redrawing a specific view inside the layout

I have a vertically aligned LinearLayout that contains a TextView, my own view class, and I hope to place an ad below.

I draw objects in my class of a custom view (which extends the view), but it does not refresh on the screen unless I call setContentView(R.layout.myview), but it resets my TextView to the default text (what is stored in the xml file), which I do not want and I guess he would also redraw the new ad ... annoying.

Is there a way so that I can redraw / update my custom view on the screen without affecting my text or anything else that I might have on my layout?

+5
source share
1 answer

How about View.invalidate()?

From reference :

Note that the structure will not draw representations that do not belong to an invalid region.

To make the image draw, call invalidate () .

+4
source

All Articles