0

I have made a customized imageview with some editing for length and height size in onMeasure() in the view class. I have set this content in onCreate method of my Main Activity, but such changes didn't apply to my imageview. Is there any solution that I can redraw my imageview in onResume method? Thus all my changes in onMeasure() in view class will apply.

Can anyone help me with this? Thanks a lot !

Vickyexpert
  • 3,147
  • 5
  • 21
  • 34
LunarS
  • 95
  • 2
  • 10
  • If your Customized View extending ImageView? Call imageView.invalidate() in OnResume(). OR make global variable and call onMessure() in OnResume – Naveen Kumar M Aug 01 '16 at 06:37
  • @NaveenKumarM Could you please see my new question? I found this invalidate method doesn't figure out the problem. Thank you! http://stackoverflow.com/questions/38711290/how-to-control-size-of-customized-imageview – LunarS Aug 02 '16 at 04:23

1 Answers1

0

Each class which is derived from the View class has the invalidate() and the postInvalidate() method. If invalidate() gets called it tells the system that the current view has changed and it should be redrawn as soon as possible.

You can do the following on your onResume() method :

@Override
protected void onResume() {
    super.onResume();
    imageView.invalidate();
}
Ricardo Vieira
  • 1,738
  • 1
  • 18
  • 26
  • Could you please see my new question? I found this invalidate method doesn't figure out the problem. Thank you! http://stackoverflow.com/questions/38711290/how-to-control-size-of-customized-imageview – LunarS Aug 02 '16 at 04:23