Monday, 12 January 2015

Pinch Gesture in Android.

* One of the cool applications of multitouch is the pinch gesture,which is used for zooming.

* The idea is that if you place two fingers on the screen and spread them apart,the application should
respond by zooming in.If your fingers come together,the application should zoom out.

* The application is usually showing images,which could be maps.

* GestureDetecter class is used to implement this.

* Its purpose in life is to receive MotionEvent objects and tell us when a sequence of events looks
like a common gesture.

Saturday, 10 January 2015

What do you understand by Gestures in Android ?

* Gestures are a special type of a touch screen event.

* The term Gesture is used for a variety of things in Android, from a simple touch sequence like a
fling or a pinch.

* Flings , pinches , long presses , and scrolls have expected behaviors with expected triggers.

* That is, it is pretty clear to most people that a fling is a gesture where a finger touches the screen,
drags somewhat quickly off in a single direction,and then lifts up.

* For Example : When someone use a fling in the Gallery application ( the one that shows images in a
left-to-right chain ), the images will move sideways to show new images to the user.

Friday, 9 January 2015

What do you understand by Multitouch in Android ?

* Multitouch has gained a lot of interest ever since the TED conference in 2006 at which Jeff Han
demonstrated a multitouch surface for a computer user interface.

* Using multiple fingers on a screen opens up a lot of possibilities for manipulating what's on the screen.

* For Ex. putting two fingers on an image and moving them apart could zoom in on the image.

* By placing multiple fingers on an image and turning clockwise , you could rotate the image on the
screen. These are standard touch operations in Google Maps, for instance.

* Android introduced support for multitouch with Android SDK 2.0.

* In that release you were able to ( technically ) use up to three fingers on a screen at the same time
to perform actions such as zoom,rotate,or whatever else you could imagine doing with multiple touches ( we say "technically" because the first Android devices to support multitouch only supported two fingers ).

Thursday, 8 January 2015

How to use VelocityTracker to handle touch screen ?

* Android provides a class to help handle touch screen sequences,and that class is VelocityTracker.

* When a finger is in motion on a touch screen,it might be nice to know how fast it is moving 
across the surfaces.

* For Example, if the user is dragging an object across the screen and lets go,your application 
probably wants to show that object flying across the screen accordingly.

* Android provides VelocityTracker to help with the math involved.

* To use VelocityTracker, you first get an instance of a VelocityTracker by calling the static method
VelocityTracker.obtain().

* You can then add MotionEvent objects to it with the addMovement(MotionEvent ev) method.

* You would call this method in your handler that receives MotionEvent objects,from a handler 
method such as onTouch(),or from a view's onTouchEvent().

* The VelocityTracker uses the MotionEvent objects to figure out what is going on with the user's
touch sequence.

* Once VelocityTracker has at least two MotionEvent objects in it.

* The two VelocityTracker methods- getXVelocity() and getYVelocity() - return the corresponding velocity of the finger in the X and Y directions.

Tuesday, 6 January 2015

What is MotionEvent Object when user touches on the screen in Android ?

* When a user touches the touch screen of an Android device, a MotionEvent object is created.

* The MotionEvent contains information about where and when the touch took place,as well as other
details of the touch event.

* The MotionEvent object gets passed to an appropriate method in our application.

* This could be the onTouchEvent() method of a View object.

* Remember that the View class is the parent of quite a few classes in Android including Layouts,
Buttons,Lists,Surfaces,Clocks and more.

* This means we can interact with all of these different types of View objects using touch events.

* When the method is called,it can inspect the MotionEvent object to decide what to do.

* For Example : A MapView could use touch events to move the map sideways to allow the user to
pan the map to other points of interest.

* Or a Virtual Keyboard object could recieve touch events to activate the virtual keys to provide text
input to some other part of the User Interface ( UI ).

About Touch Screens in Android.

* Many Android devices incorporate touch screens.When a device does not have a physical keyboard,
much of the user input must come through the touch screen.

* Therefore,your applications will often need to be able to deal with touch input from the user.

* You've most likely already seen the virtual keyboard that displays on the screen when text input is
required from the user.

* The implementation of the touch screen interface have been hidden from you so far,but now we'll
show you how to take advantage of the touch screen.

It is made up of 4 major parts : 

i)- MotionEvent
ii)- Velocity Tracker
iii)- Multitouch
iv)- Gestures.


Monday, 5 January 2015

Using the HttpURLConnection when dealing with HTTP Services.

*Android provides another way to deal with HTTP services, and that is using the
java.net,HttpURLConnection class.

* This is not unlike the HttpClient classes,but HttpURLConnection tends to require more
statements to get things done.

* On the other hand , this class is much smaller and lightweight than HttpClient.

* Starting with the Gingerbread release, it is also fairly stable.

* So,you should consider it for apps on more recent devices when you just need basic
HTTP features and you want a compact application.