I have this code :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
content = (RelativeLayout) findViewById(R.id.content);
ball = (Ball) findViewById(R.id.ball);
txt = (TextView) findViewById(R.id.textView);
txt.setVisibility(View.GONE);
Log.d("sizes", String.valueOf(content.getWidth()));
ball.setOnTouchListener(this);
}
The problem is that in log it says " 0 ". Can someone explain me what is the lifecycle of an activity and how do you measure a view or for example how do you create a bouncing ball in an activity directly on start. Thanks!