In an Activity onCreate() I instantiated a new View and added it via layout.addView to the activity. If i try getX() or getY() for that view I always get 0.0.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RelativeLayout main = (RelativeLayout)findViewById(R.id.main);
RelativeLayout.LayoutParams tpos = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
Token t = new Token(this,Token.TWO, fieldHeight,fieldWidth);
tpos.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
tpos.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
main.addView(t, tpos);
System.out.println(t.getX()); //Prints '0.0'
System.out.println(t.getY()); //Prints '0.0'