Well, after thinking about this for the night, I started working on this before calling MotionEvent.getX() and MotionEvent.getY() :
public int getAdjustment(int ptr_idx) { int adjust = 0; for (int i = 0; i < event.getPointerCount(); i++) {
Explanation of the for loop statement:
Basically, let's say we have 4 touches (Touch 0, 1, 2, 3). Now we raised Touch 0, and now we have Touch 1, 2, 3. Android will see these strokes as 0, 1, 2 and the actual index indices as 1, 2, 3. To get the right setting, I repeat the MotionEvent pointers (this 0, 1, 2 right now in the for loop).
Now, if for some reason Touch 0 or any touch between them is taken out, we must configure the index of the pointer as getX() and getY() does not understand the index of the actual touch pointer. It only accepts indexes 0, 1, 2, although we have indexes of pointers 1, 2, 3. Thus, if we reach the correct index of the touch pointer, but the touch index of MotionEvent does not match the correct pointer of the pointer of the pointer, we configure it by adjust = adjustPointerIndex-i .
After that, simply subtract it from the current ptr_idx , which we are analyzing, and get a value that getX() and getY() can understand without IllegalArgumentException for the pointerIndex parameter out of range.
It will be explained in more detail if that doesn't make sense, and if anyone has a more elegant solution, let me know because I'm sure this is not a great way to handle this. I would rather tag someone else as an approved answer.