[android-developers] MultiTouch Support

2010-12-29 Thread pedr0
Hi at all,

I have one issues with multitouch features offers by the MotionEvent
class, this is my code:

@Override
public boolean onTouchEvent(MotionEvent event) {

[]
if(event.getPointerCount() == 1){

switch (event.getAction()) {

case MotionEvent.ACTION_DOWN:
finger_one_ID = event.getAction() &
MotionEvent.ACTION_POINTER_ID_MASK;
finger_one_X = (int) event.getX(finger_one_ID);
finger_one_Y = (int) event.getY(finger_one_ID);
renderer.stopTimer();
break;

case MotionEvent.ACTION_UP:
finger_one_ID = NONE;

renderer.setFrictionY(OpenGLRenderer.DEFAULT_FRICTION_Y);

renderer.setFrictionX(OpenGLRenderer.DEFAULT_FRICTION_X);
renderer.startTimer();
break;

case  MotionEvent.ACTION_MOVE:

deltaX =  finger_one_X - (int) 
event.getX(finger_one_ID);
deltaY =  finger_one_Y - (int) 
event.getY(finger_one_ID);


deltaX = Math.abs(deltaX);
deltaY = Math.abs(deltaY);
distance = (float) ((Math.sqrt(Math.pow(deltaX,2) +
Math.pow(deltaY, 2;
renderer.setFrictionY(OpenGLRenderer.NULL_FRICTION);
renderer.setFrictionX(OpenGLRenderer.NULL_FRICTION);



if(deltaX > 5.0f && deltaX < 80)
renderer.setYacc( (deltaX  / 50));

else if(deltaY  > 5.0f && deltaY < 80)
renderer.setXacc( (deltaY / 50));

break;

default:
break;

}



Log.d(TAG, "Single finger_one_Y:"+finger_one_X);
Log.d(TAG, "Single finger_one_Y:"+finger_one_Y);


}


else if(event.getPointerCount() == 2){
Log.d(TAG,"Doppio Tocco");
switch (event.getAction()) {
case MotionEvent.ACTION_POINTER_DOWN:
finger_two_ID = MotionEvent.ACTION_POINTER_DOWN 
&
MotionEvent.ACTION_POINTER_ID_MASK;
finger_two_X = (int) event.getX(finger_two_ID);
finger_two_Y = (int) event.getY(finger_two_ID);
multitouch_distance = (float) 
Math.sqrt(Math.pow(finger_one_X -
finger_two_X, 2) + Math.pow(finger_one_Y - finger_two_Y, 2));
break;

case MotionEvent.ACTION_MOVE:
finger_one_X = (int) event.getX(finger_one_ID);
finger_one_Y = (int) event.getY(finger_one_ID);
finger_two_X = (int) event.getX(finger_two_ID);
finger_two_Y = (int) event.getY(finger_two_ID);
multitouch_distance_updated = (float)
Math.sqrt(Math.pow(finger_one_X - finger_two_X, 2) +
Math.pow(finger_one_Y - finger_two_Y, 2));

Log.d(TAG,"multitouch_distance_updated:"+String.valueOf(multitouch_distance_updated));


default:
break;
}

Log.d(TAG, "Double finger_one_Y:"+finger_one_X);
Log.d(TAG, "Doppio finger_one_Y:"+finger_one_Y);
Log.d(TAG, "Doppio finger_two_Y:"+finger_two_X);
Log.d(TAG, "Doppio finger_two_Y:"+finger_two_Y);


}

}

The problem is that in multitouch branch of my code the X,Y of first
and second finger are the same, therefore the multitouch distance is
even zero!!
I am tried to develop an two fingers zoom...

Any suggestion will be appreciated.

pedr0

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] multitouch support again...

2011-11-30 Thread John Goche
Hello,

I have posted this message before but got no repiles
so I decided to post it again because I need to detect
when a single second finger goes down while the first
one is still down on my canvas... here is my old post:

I have an LG Optimus Net (P690) which as far as I understand
claims to support multitouch (as it sais on the following site:
http://www.mobilespecs.in/2011/10/lg-optimus-net-also-known-as-p690.html
not sure if capacitive touch screen means the same thing as
multitouch.

However when I try the following code...

public boolean onTouchEvent(MotionEvent event) {

  int pointerIndex = (event.getAction() &
MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
  int action = event.getAction() & MotionEvent.ACTION_MASK;

  switch (action) {

case MotionEvent.ACTION_DOWN:

  System.out.println("got down");
case MotionEvent.ACTION_POINTER_DOWN:
  System.out.println("got pointer down");

  int screenX = (int) (event.getX(pointerIndex) * scaleX);
  int screenY = (int) (event.getY(pointerIndex) * scaleY);

I see the code run when I place the first finger down. When I place the
second
finger down without lifting the first one I don't see the
ACTION_POINTER_DOWN.

Not sure what I'm doing wrong if anything.

Thanks for your help,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] MultiTouch Support

2010-12-31 Thread TreKing
On Wed, Dec 29, 2010 at 5:57 AM, pedr0  wrote:

> Any suggestion will be appreciated.


Try updating finger_one_X and finger_one_Y. AFAICT, you're only updating #2
in your multi-touch branch.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Multitouch support in Donut?

2009-07-26 Thread quill

Look at here: http://phandroid.com/2009/07/25/morning-donuts/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Multitouch support in various device?

2010-03-23 Thread Archana
Hi,
Can anyone tell me ,how we can find whether Multitouch support is
available or not in various device?
I tried like this

try {
 FeatureInfo[] info
=_main.getPackageManager().getSystemAvailableFeatures();
 for (int i = 0; i < info.length; i++) {
  System.out.println("Info" +info[i]);
 
if(info[i].equals(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH)){
  manufacturer =true;
  Log.e("appVersion", "--->"+manufacturer);
   return manufacturer;
}
}

Its working fine for Droid and nexus,But for 1.5 version it is
throwing
03-23 20:06:41.170: ERROR/AndroidRuntime(2777): java.lang.VerifyError:

Please tell me how we can solve this.I read in Forum that we can use
Java Reflection.Can anyone tell me how we can use that.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.


[android-developers] Multitouch support in Android 2.0

2009-10-27 Thread Streets Of Boston

Kind-a burried inside the blog-post on developer.android.com (http://
developer.android.com/sdk/android-2.0-highlights.html), i saw that
multi-touch is now supported:

>>
Android virtual keyboard
•An improved keyboard layout to makes it easier to hit the correct
characters and improve typing speed.
•The ***framework's multi-touch support*** ensures that key presses
aren't missed while typing rapidly with two fingers.
•A smarter dictionary learns from word usage and automatically
includes contact names as suggestions.
<<

I'm really curious how multi-touch is supported in the API.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Multitouch support in Android 2.0

2009-10-27 Thread Jason Proctor

the G1 hardware does support multitouch. there has been a kernel & 
browser hack available for a while which enables zooming, at least.

i played with it and adapted the java side for my own purposes. IMHO 
there was a better way to do it, but it works well enough for what it 
provides.



>Does anyone know if every phone will support multi-touch (I remember
>talk about the G1's hardware might not support multi-touch)?



-- 
jason.vp.engineering.particle

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] multitouch support or no support???

2011-11-28 Thread John Goche
Hello,

I have an LG Optimus Net (P690) which as far as I understand
claims to support multitouch (as it sais on the following site:
http://www.mobilespecs.in/2011/10/lg-optimus-net-also-known-as-p690.html
not sure if capacitive touch screen means the same thing as
multitouch.

However when I try the following code...

public boolean onTouchEvent(MotionEvent event) {

  int pointerIndex = (event.getAction() &
MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
  int action = event.getAction() & MotionEvent.ACTION_MASK;

  switch (action) {

case MotionEvent.ACTION_DOWN:

  System.out.println("got down");
case MotionEvent.ACTION_POINTER_DOWN:
  System.out.println("got pointer down");

  int screenX = (int) (event.getX(pointerIndex) * scaleX);
  int screenY = (int) (event.getY(pointerIndex) * scaleY);

I see the code run when I place the first finger down. When I place the
second
finger down without lifting the first one I don't see the
ACTION_POINTER_DOWN.

Not sure what I'm doing wrong if anything.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en