How do i align a view in RelativeLayout to top-right corner
Use this:
gpsViewLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
instead of
gpsViewLayoutParams.addRule(RelativeLayout.ALIGN_RIGHT);
You may get in this way.
It is ALIGN_PARENT_RIGHT instead of ALIGN_RIGHT
http://developer.android.com/reference/android/widget/RelativeLayout.html#ALIGN_PARENT_RIGHT