I want get the width value from the imageView
object but when I run the following code It returns a 0
value. Why I get the 0
value when using the imageView.getWidth()
? How can I solve this problem?
public class MainActivity extends Activity {
ImageView imageView;
TextView textView;
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_main);
imageView= (ImageView) findViewById(R.id.imageView);
textView = (TextView) findViewById(R.id.textView);
Integer i = imageView.getWidth();
textView.setText(i.toString());
}}