Finish (Close) a Android Activity on Touch -


how terminate activity in adroid on touch. here shows view described in details.xml. need dismiss activity on touch. tried following code. not working. ideas?

public class details extends activity {     protected void oncreate(bundle savedinstancestate){         super.oncreate(savedinstancestate);         setcontentview(r.layout.details);     }     public boolean ontouchevent(motionevent event){         this.finish();         return true;     }        } 

  1. your ontouchevent() called if no other views under finger in view hierarchy have consumed event. uncommon, since many views interact touch events.

  2. it wrong stuff in ontouchevent() without @ actual event is.

  3. generally should implement view reacts touches , appropriate thing.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -