MultiTouch app and MotionEventActions

RickElliottRickElliott USUniversity ✭✭

Hi, there. I'm trying to setup a multi-touch application for Android and I'm running into an issue with the MotionEventActions enumeration. I've been googling about the web for some multi-touch examples for Mono for Android and this fit nicely for me:

http://slodge.blogspot.com/2012/11/a-simple-multitouch-view-for-monodroid.html

Unfortunately, I seem to be missing several values from the MotionEventActions enumeration. From the Xamarin docs, it looks like there are several (I'm looking for the PointerIdMask, PointerIdShift, Mask values specifically):

androidapi.xamarin.com/?link=T%3aAndroid.Views.MotionEventActions

However, I only have the following available in Visual Studio: Up, Down, Move, Outside, Cancel.

Have some of these values been moved to another enumeration? Is the example wrong (it's dated 11/27/12, so it's not that old)? Any thoughts would be appreciated. Thanks.

Posts

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    Have some of these values been moved to another enumeration?

    No; some values depend on the $(TargetFrameworkVersion), i.e. which Android Target framework you're compiling against. For example, MotionEventActions.Scroll is MotionEvent.ACTION_SCROLL, which was added in API 12 (Android v3.1).

    You will probably need to change your $(TargetFrameworkVersion) to use those values.

  • RickElliottRickElliott USUniversity ✭✭
    edited April 2013

    Hi, Jon. Thanks for the reply. I had also thought the same thing after I posted. My project originally targeted API 8 (2.2), so I bumped it all the way up to API 17 (4.2) and several in between, stopped/started VS, did a clean/rebuild... still no joy. My current AndroidManifest.xml looks okay from what I can tell (I've been changing the API in the Project Properties, not in the manifest directly):

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal">
        <uses-sdk android:targetSdkVersion="17" />
        <application android:label="AndroidBasicsStarter" android:debuggable="true"></application>
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    </manifest>`
    

    Am I still missing something? Thanks for the help.

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    Am I still missing something? Thanks for the help.

    The issue isn't your AndroidManifest.xml, the issue is your .csproj: What <TargetFrameworkVersion/> value does it contain? Is it v4.2? v2.2? Does it have a <TargetFrameworkVersion/> element at all?

  • RickElliottRickElliott USUniversity ✭✭

    Oops... now I understand. My TargetFrameworkVersion was v1.6, which is the Minimum Android to target in the Project Properties... multi-touch wasn't supported then. DOH! I set it to 2.1 and I now have the values I was looking for. Thanks for clearing up the confusion, I appreciate it.

Sign In or Register to comment.