The following code does not make the popupWindow popup, most of the things I tried to make it work make it crash, some of them are commented, the rest just doesn't make the cut. Any leads?
// Popup the login
private void loginPopup(){
// Get the contents
RelativeLayout loginLayout = (RelativeLayout) findViewById(R.id.login_popup_layout);
EditText usernameTxt = (EditText) findViewById(R.id.login_popup_username);
EditText passwordTxt = (EditText) findViewById(R.id.login_popup_password);
Button registerBtn = (Button) findViewById(R.id.login_popup_register);
Button loginBtn = (Button) findViewById(R.id.login_popup_login);
Button GloginBtn = (Button) findViewById(R.id.login_popup_G);
Button FBloginBtn = (Button) findViewById(R.id.login_popup_FB);
//loginLayout.addView(usernameTxt);
// Popup the login menu
//View popupView = getLayoutInflater().inflate(R.layout.login_popup_layout, null);
PopupWindow loginPopup;
loginPopup = new PopupWindow(loginLayout, 100, 100);// The last true is to make it focusable
loginPopup.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
//loginPopup.setContentView(loginLayout);
// Center the popup and display it.
Display display = getWindowManager().getDefaultDisplay();
Point size=new Point();
display.getSize(size);
loginPopup.showAtLocation((RelativeLayout)findViewById(R.id.displayLayout), Gravity.NO_GRAVITY, 50,50 );//(size.x/2)-loginPopup.getWidth()/2 , (size.y/2)-loginPopup.getHeight()/2 );}