Issue
private void getPicDetails() {
targetW = img_cow.getWidth();
targetH = img_cow.getHeight();
Log.e("targetW: ", "" + targetW);
Log.e("targetH: ", "" + targetH);
}
I have an image view and the method above gets the height and width to print the values of height and width. Now when I call getPicDetails()
in onCreate, the values are 0, same as when I put it in OnStart
and onResume
.
My question is: where should I put my method such that the imageview is initialized and exists?
Solution
you can call inside the onWindowFocusChanged
@Override
public void onWindowFocusChanged(boolean hasFocus){
int width=imageView.getWidth();
int height=imageView.getHeight();
}
Answered By - Aerrow
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.