Add this in <head>
<meta name="format-detection" content="telephone=no"/>
I have created this blog to help programmers who have just started their career thats why I have written all the tutorials from practical approach rather then theoretical. If anyone has any query related to programming don't hesitate to ask. My contact information is in my profile. Also I would like to thank all the websites/Individual(s) from whom I gathered the material.
<meta name="format-detection" content="telephone=no"/>
//Implement the following events in your class
public class ActivitySwipeDetector implements View.OnTouchListener {
static final String logTag = "ActivitySwipeDetector";
static final int MIN_DISTANCE = 100;
private float downX, downY, upX, upY;
public void onRightToLeftSwipe(){
Log.i(logTag, "RightToLeftSwipe!");
activity.doSomething();
}
public void onLeftToRightSwipe(){
Log.i(logTag, "LeftToRightSwipe!");
activity.doSomething();
}
public void onTopToBottomSwipe(){
Log.i(logTag, "onTopToBottomSwipe!");
activity.doSomething();
}
public void onBottomToTopSwipe(){
Log.i(logTag, "onBottomToTopSwipe!");
activity.doSomething();
}
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN: {
downX = event.getX();
downY = event.getY();
return true;
}
case MotionEvent.ACTION_UP: {
upX = event.getX();
upY = event.getY();
float deltaX = downX - upX;
float deltaY = downY - upY;
// swipe horizontal?
if(Math.abs(deltaX) > MIN_DISTANCE){
// left or right
if(deltaX < 0) { this.onLeftToRightSwipe(); return true; }
if(deltaX > 0) { this.onRightToLeftSwipe(); return true; }
}
else {
Log.i(logTag, "Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE);
return false; // We don't consume the event
}
// swipe vertical?
if(Math.abs(deltaY) > MIN_DISTANCE){
// top or down
if(deltaY < 0) { this.onTopToBottomSwipe(); return true; }
if(deltaY > 0) { this.onBottomToTopSwipe(); return true; }
}
else {
Log.i(logTag, "Swipe was only " + Math.abs(deltaX) + " long, need at least " + MIN_DISTANCE);
return false; // We don't consume the event
}
return true;
}
}
return false;
}
}
//To Bind the touch events on your controlsActivitySwipeDetector activitySwipeDetector = new ActivitySwipeDetector(this);
lowestLayout = (RelativeLayout)this.findViewById(R.id.lowestLayout);
lowestLayout.setOnTouchListener(activitySwipeDetector);
function getInternetExplorerVersion()
{
var rv = -1; // Return value assumes failure.
//You can user "navigator.appName" to detect other browsers as well.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
{
rv = parseFloat(RegExp.$1);
if (rv > -1)
{
if (rv < 9.0)
{
alert("This is Not Microsoft Internet Explorer 9.0");
return;
}
}
}
}
}