Why isn鈥檛 multi-touch wor king for imagebuttons?

by niko20 » Wed, 05 May 2010 01:42:31 GMT


Sponsored Links
 Hi,

No, it's because the android team decided to implement MultiTouch in a
way that it only can be used on one "View". For example, ImageButtons
are views. Each ImageButton is a seperate "View" object. The Android
multitouch does not just map touches to multiple views like that
(which I think it should, but the android team does not). Instead you
end up having to create a View yourself, and drawing the three buttons
yourself, since multitouch comes to a View as additional touch
coordinates. In other words, you can only use multitouch "per view".
It can't spread across multiple views. You basically need to create
one big view object that takes up most of the screen and then draw the
buttons yourself, and then handle the multitouch messages passed to
that view.

Unless there is an easier way that I know of, but I dont think there
is. IMO how they "implemented" multitouch is too hackish, and should
have been transparent to developers by the system automatically
posting messages to each view that was being touched, instead, you
have to rewrite the apps completely to handle it.

-niko



>



Why isn鈥檛 multi-touch wor king for imagebuttons?

by Bob Kerns » Fri, 07 May 2010 23:05:14 GMT


 What about using a TouchDelegate to examine the touches first, and
forward them as separate events?

I haven't tried it, or even thought about it for more than two
minutes, but...




> >


Sponsored Links


Other Threads

1. onRestoreInstanceState exception only on froyo for a simple textview

I have an application with an activity group, and it uses the local
activity manager class to start a subactivity and insert that
subactivity's view.  I do not have any custom onSaveInstanceState
logic written anywhere in my app.  I have a nested layout of relative
layout -> textview within that subactivity's view, and the text view's
id is "recent_apps_label".  I get this exception every time I rotate
the device to/from portrait/landscape orientation on froyo ONLY, never
saw this on eclair.

Please help - I have NO idea as to how the parcelable object getting
sent to onRestoreInstanceState would be for a list view.  I even
changed the id to something even more unique and it didn't fix the
problem.  I have a different layout file for the containing layout in
layout-land-mdpi, layout-port-mdpi, and layout-port-hdpi FYI.

Here is the exception:

E/AndroidRuntime( 1106): java.lang.IllegalArgumentException: Wrong
state class, expecting View State but received class
android.widget.AbsListView$SavedState instead. This usually happens
when two views of different type have the same id in the same
hierarchy. This view's id is id/recent_apps_label. Make sure other
views do not use the same id.
E/AndroidRuntime( 1106):        at
android.view.View.onRestoreInstanceState(View.java:6162)
E/AndroidRuntime( 1106):        at
android.widget.TextView.onRestoreInstanceState(TextView.java:2422)
E/AndroidRuntime( 1106):        at
android.view.View.dispatchRestoreInstanceState(View.java:6138)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:
1209)
E/AndroidRuntime( 1106):        at
android.view.View.restoreHierarchyState(View.java:6117)
E/AndroidRuntime( 1106):        at
com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:
1530)
E/AndroidRuntime( 1106):        at
android.app.Activity.onRestoreInstanceState(Activity.java:843)

-- 

2. Thoughts on this LenientPolicy implementation of an LVL Policy?

Mark, would you be willing to share your updated code? I find your
policy more sensible during the toddler phase of LVL. Until maturity
of ServerManagedPolicy is proven, I need to play it safe for an
existing app with many users that I don't want to alienate.

-- 

3. pinch-zoom image displayed in gallery

4. Sqlite Delete doesn't delete

5. How do you create a custom Preference which needs to invoke a "activity for result" like RingtonePreference?

6. Enable usb debugging (under settings/applications/development) programatically from within app

7. Error in an XML file eclipse