Code example for PopupWindow

Methods: getHeightgetWidthshowAtLocationupdate

0
     * @param v 
     * @param x 
     * @param y 
     */ 
    private void displayHint(final View v, final int x, final int y) {
        mWindow.showAtLocation(mPopupLayout, Gravity.NO_GRAVITY, x, y);
 
        mPopupLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
        final int[] newCoords = adjustLocationByCorner(x, y);
        mWindow.update(newCoords[0], newCoords[1], mWindow.getWidth(), mWindow.getHeight());
 
    } 
 
    /** 
     * Returns the coordinates to place the popup into related to a given view 
     * @param v the view to place the hit near to 
     * @return a 2 element array with x,y coordinates 
     */ 
    private int[] getPopupLocation(final View v){
        int[] viewLocation = new int[2];
        v.getLocationOnScreen(viewLocation);