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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -