title: Calculate swipe area in touchevent
body: <p>I am calculating the swipe area in android tab. Requirement is that when user swipes on the top 10% of the screen in tab a popup should come.</p>
  
  <p>How can i achieve it by using the touch event of onFling();</p>
  
  <p>Right now I am doing it like below, (arg0 and arg1 are Motion events)</p>
  
  <pre><code>int height = this.webview.getHeight();
  float x = arg0.getRawX();
  float y = arg0.getRawY();
  float x2 = arg1.getRawX();
  float y2 = arg1.getRawY();
  
  if (x &lt; 2000.00 &amp;&amp; x2 &lt; 2000.00 &amp;&amp; y &lt; 200.00 &amp;&amp; y2 &lt; 80.00) {
  showPopUp();
  }
  </code></pre>
  
  <p>But, I dont want to use the hardcoded values like 2000.00 or 80.00. Instead of this the swipe should be calculated based on the device height. Though this is working fine.</p>
  
  <p>Any idea how to do it?</p>