I realize there is a question similar to this on stack overflow (getWidth() and getHeight() of View returns 0) that has gotten much attention. It seems like I may be calling getWidth too early, but how can I be sure that it does have an actual width though? I'm worried because I believe I may be getting a size of zero because of how I'm implementing an imageBitmap and not an imageResource.
My onCreate:
// Byte array to bitmap
BitmapFactory.Options options = new BitmapFactory.Options();
options.inMutable = true;
mainImageBitmap = BitmapFactory.decodeByteArray(byteArray, 0,
byteArray.length, options);
// Set bitmap
mainImageView.setImageBitmap(mainImageBitmap);
Log.e("", mainImageView.getWidth() + " ");
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(400, 400); //Want to use getWidth and getHeight here, just hardcoding to 400 for now
layout.setLayoutParams(params);