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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -