android - How to add in the parameter for MotionEvent -
i have written codes location imageview. below code:
private void touchlocation(motionevent e){ float x = e.getx(); float y = e.gety();  string message = "location x = " + x + ", y = " + y ".";  context context = getapplicationcontext(); int duration = toast.length_long:  toast toast = toast.maketext(context, message, duration); toast.show(); }
in oncreate() method, how shall call function? suggestion appreciated. how shall instantiate object class motionevent?
imageview.setontouchlistener(new ontouchlistener(){     @override    public boolean ontouch(view v, motionevent e) {       float x = e.getx();      float y = e.gety();       string message = "location x = " + x + ", y = " + y ".";       // more code       return true;      }  }); 
Comments
Post a Comment