creating multiple screen resolution Code base UI for android

view story

http://stackoverflow.com – This is my First question on Stack and So sorry for my bad english. I am working on Android app in which i have to design code based ui (No xml ui or layout) what i have done so far is i have created different class for different controls like for button i have a custom button class in which i have my own method to create button. now the problems came to handling width and height and position of any ui control on different screen sizes. Can any body help me how to do that. I already created method to detect what type of screen and its height and width but still no success . Please Help. Tha (HowTos)