1 Reply Latest reply: Nov 26, 2013 5:01 AM by rukbat RSS

    I Need help in my android application please, There is an error while we run it on HD high resolution only while on other device with low resolution it is work properly

    fef1faa1-a400-41dd-aeff-0c2b9b97a270

      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());

                      if(x[a][b]==false){

                          v.setBackgroundDrawable(enterShapeAcp);

                          }

                      if(x[a][b]==true){

                          v.setBackgroundDrawable(enterShapeRej); }

                      break;}

                 

                  case DragEvent.ACTION_DRAG_EXITED:{

                      v.setBackgroundDrawable(normalShape);

                      break;}

                 

                  case DragEvent.ACTION_DROP:{

                      grid(v.getX(),v.getY());

                      View view = (View) event.getLocalState();

               

       

                      if(x[a][b]==true){

                         

                          view.setVisibility(View.VISIBLE);

                          }

                      else{

                          ViewGroup owner = (ViewGroup) view.getParent();

                          owner.removeView(view);

                          LinearLayout container = (LinearLayout) v;

                          container.addView(view);

                          view.setVisibility(View.VISIBLE);

                          x[a][b]=true;

                          x[m][n]=false;

           

                          grid(v.getX(),v.getY());

                         

                          if(view.getId()==R.id.a){

                              if(a==0 && b== 0){

                                  posA=true;}

                              else{

                                  posA=false;}} 

                         

                          if(view.getId()==R.id.b){

                              if(a==1 && b== 0){

                                  posB=true;}

                              else{

                                  posB=false;}} 

                        

                          if(view.getId()==R.id.c){

                              if(a==2 && b== 0){

                                  posC=true;}

                              else{

                                  posC=false;}}

                         

                          if(view.getId()==R.id.d){

                              if(a==3 && b== 0){

                                  posD=true;}

                              else{

                                  posD=false;}}

                         

                          if(posA == true && posB == true &&posC == true &&posD == true){              

                            /*  toast  = Toast.makeText(getApplicationContext(),  " ****** \n DONE \n ******", Toast.LENGTH_SHORT);

                              toast.setGravity(Gravity.CENTER, 0, 0);

                              toast.show();*/

                          mm = MediaPlayer.create(getApplicationContext(), R.raw.msn);

                          mm.start();

                          v1.startAnimation(animRotate);

                          v2.startAnimation(animRotate);

                          v3.startAnimation(animRotate);

                          v4.startAnimation(animRotate);

                          }

                      

                          /* toast  = Toast.makeText(getApplicationContext(), a +  "<><><>" + b , Toast.LENGTH_SHORT);

                           toast.setGravity(Gravity.CENTER, 0, 0);

                           toast.show();*/

                          }//else  

                       break;}

                 

                  case DragEvent.ACTION_DRAG_ENDED:{

                     v.setBackgroundDrawable(normalShape);

                     break;}  

                 

                  default:{

                       break;}

                   }//switch

                  

                  return true;

            

              }//onDrag

          }//class MyDragListener

        

      }//main class DragDropTest