DragDrop application goes wrong when changing screen size
<p>I am making a small application on android, it is based on dragdrop with shadowbuilder, i used an emulator with screen wvga800 (800x480), it was working fine, when draging an element to a grid it drops properly in the destination grid.
Then i used another emulator with screen wxga800-7in (1280-800), it went all wrong,
the elements dont drop anymore inside the grid, they appear to shift to another position.
note: in the layout XML file the used unit is dp.
What is excactly the problem here? please help.</p>

<p>Thanks in advance for any help.</p>

<p>The following are the code for touch listener and drag listener : </p>

<pre><code> private final class MyTouchListener implements OnTouchListener {

        public boolean onTouch(View view, MotionEvent motionEvent) {

            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                ClipData data = ClipData.newPlainText("", "");
                DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);              
                view.startDrag(data, shadowBuilder, view,0);
                view.setVisibility(View.INVISIBLE);
                return true;}
            else {
                return false;
            }
        }
    }//class MyTouchListener


class MyDragListener implements View.OnDragListener {
        Drawable enterShapeAcp = getResources().getDrawable(R.drawable.shape_droptargetacp);
        Drawable enterShapeRej= getResources().getDrawable(R.drawable.shape_droptargetrej);
        Drawable normalShape = getResources().getDrawable(R.drawable.shape);

        @Override
        public boolean onDrag(View v, DragEvent event) {
           // int action = event.getAction();
            switch (event.getAction()) {

            case DragEvent.ACTION_DRAG_STARTED:{
                break;}

            case DragEvent.ACTION_DRAG_ENTERED:{
                grid(v.getX(),v.getY());
                    v.setBackgroundDrawable(enterShapeAcp);

                break;}

            case DragEvent.ACTION_DRAG_EXITED:{
                v.setBackgroundDrawable(normalShape);
                break;}

            case DragEvent.ACTION_DROP:{
                View view = (View) event.getLocalState();

                    ViewGroup owner = (ViewGroup) view.getParent();
                    owner.removeView(view);
                    LinearLayout container = (LinearLayout) v;
                    container.addView(view);
                    view.setVisibility(View.VISIBLE);

                 break;}

            case DragEvent.ACTION_DRAG_ENDED:{
               v.setBackgroundDrawable(normalShape);
               break;}   

            default:{
                 break;}
             }//switch

            return true;

        }//onDrag
    }//class MyDragListener
</code></pre>
