I'm trying to get values from myImageView.getImageMatrix()
method once my activity is ready.
I tried using the onCreate()
, onStart()
, onResume()
methods but the matrix I get is the default.
If I call myImageView.getImageMatrix()
triggered by an OnClickListener, after my activity is visible, I get the right values.
Just to be more clear:
calling getImageMatrix onStart = Matrix{[1.0, 0.0, 0.0][0.0, 1.0,
0.0][0.0, 0.0, 1.0]}
calling getImageMatrix onClick = Matrix{[0.77488154, 0.0,
7.6717987][0.0, 0.77488154, 0.0][0.0, 0.0,
1.0]}
You can also try this method:
ImageView myImageView = (ImageView) findViewById(R.id.myImageView);
ViewTreeObserver vto = myImageView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// do something now when the object is loaded
// e.g. find the real size of it etc
myImageView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});