How to set up smartphones and PCs. Informational portal
  • home
  • Errors
  • How many touches the screen supports. What is a multitouch screen and how do you distinguish it from a simple touchscreen display? Electronic devices with multitouch

How many touches the screen supports. What is a multitouch screen and how do you distinguish it from a simple touchscreen display? Electronic devices with multitouch

In this tutorial:

Handling multiple touches

Having dealt with a single touch in the last lesson, we proceed to multiple touch, which is called multitouch.

The system can handle up to 10 touches inclusive. There is an opinion that it has something to do with the number of fingers on the hands :) Keep in mind that not all devices support 10 touches.

Let's consider the event system for multitouch. The ACTION_DOWN, ACTION_MOVE, and ACTION_UP events are appended with ACTION_POINTER_DOWN and ACTION_POINTER_UP.

ACTION_DOWN - fires when the first finger is touched
ACTION_POINTER_DOWN - fires when each subsequent finger is touched
ACTION_MOVE - triggers on any movement
ACTION_ POINTER_UP - fires when every finger is released except the last
ACTION_ UP - fires when the last finger is released

Now we need to understand how to distinguish - for which finger the ACTION_POINTER_DOWN and ACTION_ POINTER_UP events were triggered. For this, two numbering systems are used - index and ID.

Indexserial number finger. Not tied to a finger - one finger can have different indexes in one touch.

ID- is attached to the finger from the beginning to the end of the touch.

To make it clearer, consider the situation with three fingers. Let's designate them - P1, P2 and P3. We will touch the screen with them and see what indexes and IDs the system assigns to them.

We touch the screen with our finger P1.

Now let go of finger P1. We get:

We see that P2 and P3 have retained their IDs, and their indices have shifted.

Let go of finger P2, we get:

P3 has retained its original ID. And its index was at first 2, then 1, now 0.

We hold P3. Let's touch the screen with our finger P1, we get:

We hold P3 and P1. Let's touch the screen with our finger P2, we get:

P2 got the first free ID - 1. And he shifted P3 in the index list.

In this example, we see that the new touch gets the minimum free ID, and the indices are always rebuilt so that the IDs go in ascending order. In this example, you can clearly see that the ID is attached to the touch (as long as it lasts - the ID is unchanged). And the indices are just numbers of touches, but these numbers do not mean the order of the touches at all. Indexes and IDs can range from 0 to 9.

Let's go back to the events. The UP and DOWN events contain the touch index. At this index, we can always get the ID. The MOVE event does not provide information about the indexes. It simply notifies that some movement is taking place.

Let's write an application that will display the index of the last finger touched, the index of the last released finger, and the entire table of indexes, IDs, and coordinates of touches.

Let's create a project:

Project name: P1031_MultiTouch
Build Target: Android 2.3.3
Application name: MultiTouch
Package name: ru.startandroid.develop.p1031multitouch
Create Activity: MainActivity

We don't need strings.xml and main.xml again, we don't touch them.

Code MainActivity.java:

Package ru.startandroid.develop.p1031multitouch; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.TextView; public class MainActivity extends Activity implements OnTouchListener (StringBuilder sb = new StringBuilder (); TextView tv; int upPI = 0; int downPI = 0; boolean inTouch = false; String result = ""; / ** Called when the activity is first created . * / @Override public void onCreate (Bundle savedInstanceState) (super.onCreate (savedInstanceState); tv = new TextView (this); tv.setTextSize (30); tv.setOnTouchListener (this); setContentView (tv);) @Override public boolean onTouch (View view, MotionEvent event) (// event int actionMask = event.getActionMasked (); // touch index int pointerIndex = event.getActionIndex (); // number of touches int pointerCount = event.getPointerCount (); switch (actionMask) (case MotionEvent.ACTION_DOWN: // first touch inTouch = true; case MotionEvent.ACTION_POINTER_DOWN: // subsequent touches downPI = pointerIndex; break; case MotionEvent.ACTION_UP: // breaking the last touch inTouch = false; sb.setLength ( 0); case MotionEv ent.ACTION_POINTER_UP: // interrupt touches upPI = pointerIndex; break; case MotionEvent.ACTION_MOVE: // motion sb.setLength (0); for (int i = 0; i< 10; i++) { sb.append("Index = " + i); if (i < pointerCount) { sb.append(", ID = " + event.getPointerId(i)); sb.append(", X = " + event.getX(i)); sb.append(", Y = " + event.getY(i)); } else { sb.append(", ID = "); sb.append(", X = "); sb.append(", Y = "); } sb.append("\r\n"); } break; } result = "down: " + downPI + "\n" + "up: " + upPI + "\n"; if (inTouch) { result += "pointerCount = " + pointerCount + "\n" + sb.toString(); } tv.setText(result); return true; } }

V onCreate we create a TextView, assign a handler to the current Activity, and place it in the Activity.

We deal with onTouch... If for one touch we used the getAction method to understand what event happened, then with multitouch we need to use getActionMasked. The touch index is determined by the getActionIndex method. Number of current touches - getPointerCount.

If the event is ACTION_DOWN, so we got the first touch. We put the label inTouch = true. It will mean for us that there are touches. Please note that in this case branch we do not put a break - the next case branch (ACTION_POINTER_DOWN) will also be executed at ACTION_DOWN.

If the event ACTION_POINTER_DOWN(or ACTION_DOWN), then we put the touch index into the downPI variable. This will be the index of the last finger touched.

If the event is ACTION_UP, then the last touch is interrupted and nothing else touches the screen. We put inTouch = false, i.e. no touch. We clear the StringBuilder that contains information about the movements.

If the event is ACTION_POINTER_UP(or ACTION_UP), then we put the touch index into the upPI variable. This will be the index of the last interrupted touch. Those. when we interrupt touches one by one, this variable will contain one by one the indices of the last interrupted one.

If the event ACTION_MOVE- we iterate over all existing indexes. Using pointerCount, we determine which of them are currently involved and contain information about touches. For them, we write the index number, ID (getPointerId method) and coordinates (getX and getY). For unused ones, write only the index number. We write all this in StringBuilder.

Then, for any event, we form result, write there the index of the last touch and the last completed touch. If in this moment there is a touch (inTouch), then we add the contents of the StringBuilder to the result with detailed information about all touches. And we output the result to the TextView.

Let's save and run everything. On an emulator, I don't know how to achieve multitouch, so I'm testing on a tablet. Screen from it.

I touched the screen with 5 fingers (sequentially from thumb to pinky, ID from 0 to 5) and then removed one (index, ID = 1) from the screen.

down shows that the last finger touched was index 4

up shows that the last finger removed from the screen was index 1

pointerCount shows the number of active touches

And the lines by indices show detailed information about touches.

The modern world of technology is regularly updated with new gadgets and various technical equipment... Almost everyone has heard this buzzword like a "multitouch screen". However, not all users can rationally evaluate. Let's take a closer look at what a multitouch screen looks like, what kind of technological innovation is this?

Multi-touch is. He is able to respond to multiple touches at the same time. There is no keyboard in such a device, and the main tool is light finger touches. If you translate the term from in English, then it means “multiple touch”.

Back in the sixties of the last century, great minds worked to create a high-tech touch screen. All these innovations were applied at CERN (center for nuclear research in Europe). The public first saw such screens in New York, and their designer was Jeff Khan. It was at the beginning of the XXI century that everyone in the world started talking about unreal technologies, when you can control the monitor picture with just one touch of your finger. It was a real technological explosion, and a huge step in the world of electronics.

The value of multitouch in the modern world

Now, when we got acquainted with this device, the question arises of what a multitouch screen means in modern world? Maybe there is no point and not everyone is ready to overpay for it? It only seems so, in fact, such touching the screen not only simplifies the task, but also saves the user's time. You, of course, do not notice how automatically you try to enlarge the picture with two fingers. Agree, this function is very convenient and confusion arises when a new touch gadget does not respond to this action.

If an ordinary user can live without these innovations in the device, then he will face a lot of difficulties. Today many famous manufacturers adapt management gameplay it is under the multitouch screen. They just give up button commands and use modern technologies to simplify the gameplay.

Using multitouch in gadgets:

  • Management of games and entertainment applications.
  • Scale an image with one touch.
  • Easy application management and time saving.

Distinguishing characteristics of multitouch from a conventional touchscreen

These two screens should not be confused. Ordinary sensor reacts to only one touch, for him is of particular importance. Multi-touch screen control is based on several touches at the same time.

Engineers regularly develop new combinations that should facilitate the operation and management of electronic devices. Smartphone owners have long felt the benefits of the zoom feature. Many manufacturers claim that their gadgets are capable of recognizing 10 to 20 touches synchronously.

Multi-touch display: device and application

Screen construction

Almost all modern mobile devices support this function. What is multitouch in a tablet? The answer here will be simple - freedom of action and time savings when working with many applications. Many laptops are also equipped with this feature.

Such a screen can be developed in several technological ways, but the most practical and popular remains - resistive... Samuel Hirst is the main developer. The main advantage in this production scheme is. True, this method was popular until 2008. After that, more universal options creating a multitouch screen: strain gauge, optical and inductive touchscreens. Today, many creators are working on a projected capacitive touch screen, which is used by the famous Apple in their gadgets.

What does this high-tech screen consist of? A glass panel covered with a resistive layer is called a capacitive monitor. There are four electrodes in the corners of the display that transmit AC voltage... As soon as a finger touches the monitor, an instantaneous leakage current occurs. How more sizes display, the more touch points the device recognizes.

Additional features

Buyers around the world are buying gadgets in which they are present. Unsurprisingly, Apple is actively implementing screens like this across all of its mobile devices. Surely everyone who has held such a device in their hands can understand its advantages over others. But still pay attention to additional features for those who doubt the functionality of such equipment:

  • Simple operation, time saving.
  • It is convenient to use such devices, as they harmoniously fit into the everyday life of a person.
  • The device can be operated by several users, but before that it is necessary to make sure that it is present.
  • The control takes place on an intuitive level, so not only children, but also pensioners can cope with the devices. Buttons are always misleading, and their absence makes the workflow easier to understand.

Application area

The touch capacitive multitouch screen is understandable to almost everyone, which is why it is being implemented not only in computers and mobile devices, but also in household appliances. Even children are easy to deal with. The equipment has an additional plus if the control is carried out through a sensor with several touches. A variety of multitouch panels are especially popular in in public places: schools, medical centers, shopping pavilions and children's entertainment centers. They are often used to provide necessary information and as advertising panels.

Visitors move around easily electronic map and get acquainted with product catalogs. Such systems are equipped with a microphone and speakers, which also simplifies the process of perceiving the necessary information for potential buyers and visitors. It is very important that the display picture always differs in brightness and contrast, while the monitor is protected from scratches and other possible mechanical damage... Every entrepreneur wants to purchase such a multitouch panel, as it increases the level of perception and adds prestige to any company.

How do you know if the phone has multitouch?

It is very important to be able to recognize the presence of such a screen even before buying.... Today there are many scammers who give out ordinary sensory devices for the high-tech multitouch screen:

  • Also in the shopping pavilion, turn on your device and go to the Googl Maps menu. If the device has multitouch, then scaling in this program will be done with two finger touches. Otherwise, this means that the seller is giving you incorrect information, so buy another model.
  • Before making a purchase, visit the manufacturers' websites. There you will find about each device.
  • The resistive screen in tablets and smartphones is not equipped with a multitouch function, however, there are users who vehemently prove the opposite. It's just that on such screens you can only implement the function of rotating and scaling with two fingers, but this is where its capabilities end. you will not be able to play, which will surely frustrate every user who was counting on an enjoyable gameplay.

Today monitors are not big enough to work with both hands, but in the near future every gadget will have such technological multitouch screens. Everything that was once shown in science fiction films is now being implemented and actively introduced into people's everyday life. Great minds regularly add new features to gadgets and use the multi-touch screen to control, while developing new combinations and improving the technology itself. Touch screen- this is the face of today's technology and our entire future undoubtedly stands behind it.

When we consider the characteristics of a smartphone or tablet, we often see many terms in the description that are hitherto unfamiliar to us. One such term might be multitouch. So it is written opposite the screen - multitouch. What this means is not disclosed in the characteristics. In fact, everything is much simpler.

Multitouch is formed from the English. Multi-touch, which can be translated as "multiple touch". Already proceeding from this, we can conclude that it comes about a screen (touch panel) that supports multiple touches at once.

How much exactly? The question is interesting, because multi - many - in in this case does not speak about a certain number of supported touches, which means that a multi-touch screen can be called a touch panel that supports more than one touch.

How do you know exactly how many touches your tablet or smartphone supports? This can be found out using the characteristics of the device, but if for some reason you do not trust them, it does not matter, you can use special applications for example MultiTouch Tester or AnTuTu:

And here are 5 touches:

As you can see, in this case Touchpad supports up to 10 touches.

What is multitouch for?

Multich allows you to use additional functions. Here are some of them:

  • Move fingers - decrease.
  • Spread your fingers - increase.
  • Move with several fingers - scrolling up and down, left and right.
  • Rotate with two fingers - Rotate an object.

Multi-touch is actively used in applications. For example, games sometimes require more than two touches. This means that if the panel supports only two touches (there are such ones), you will not be able to play the toy fully.

Top related articles