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]}
SetContentView(View, ViewGroup+LayoutParams)Set the activity content from a layout resource.
As onCreate() of an Activity is called only once, this is the point where most initialization should go: calling setContentView(int) to inflate the activity's UI, using findViewById to programmatically interact with widgets in the UI, calling managedQuery(android.
setContentView(View) is a method exclusively available for Activity. Internally it calls the setContentView(View) of Window. This method sets the activity content to an explicit view. SetContentView() method is 3 types. setContentView(int resourceId)
setContentView(int layoutid) - method of activity class. It shows layout on screen.
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);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With