Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:52:05+00:00 2026-06-05T06:52:05+00:00

Java implements OnClickListener, OnTouchListener how these processes can not find easily while the mono?

  • 0

Java implements OnClickListener, OnTouchListener how these processes can not find easily while the mono? Thank you in advance …

public class MyClass implements OnClickListener, OnTouchListener {
    @Override
    public boolean onTouch(View v, MotionEvent event) {

        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:

            break;
        case MotionEvent.ACTION_UP:

            break;
        default:

            break;
        }

        return false;
    }

    @Override
    public void onClick(View v) {

    }
}

How do I make this process a mono?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:52:06+00:00Added an answer on June 5, 2026 at 6:52 am

    A literal translation of that sample to C# and Mono for Android would look like this:

    public class MyClass : Java.Lang.Object, View.IOnClickListener, View.IOnTouchListener
    {
        public bool OnTouch(View v, MotionEvent e)
        {
            switch (e.Action)
            {
                case MotionEventActions.Down:
                    break;
                case MotionEventActions.Up:
                    break;
                default:
                    break;
            }
    
            return false;
        }
    
        public void OnClick(View v)
        {
        }
    }
    

    While it is still possible to write your apps this way, following the Java conventions, there are nicer ways to do it in Mono for Android. In most cases where Java uses listener interfaces, Mono for Android will actually provide an event you can handle, which is much easier to use (and more C#-friendly). In this example you’d want to handle the Touch and Click events on a view:

    view.Touch += (sender, args) =>
                  {
                      switch (args.Event.Action)
                      {
                          case MotionEventActions.Down:
                              break;
                          case MotionEventActions.Up:
                              break;
                          default:
                              break;
                      }
                  };
    view.Click += (sender, args) =>
                  {
                  };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my Manual.java file: public class Manual extends Activity implements OnClickListener{ Button create;
I have the following Java code: public class FirstActivity extends Activity implements OnClickListener {
I have this class public class wordObject implements java.io.Serializable { String wordName; int occCount;
package com.em.progressb; public class progressb extends Activity implements OnClickListener { ProgressDialog dialog; int increment;
Does anyone know how Java implements its hash tables (HashSet or HashMap)? Given the
If I have a class that implements java.lang.Runnable , there is technically nothing stopping
I am creating a class that implements java.util.List . My class is using E
So I've got a Java class that implements Runnable. In the run method I've
MyActivity implements a CustomListener defined in MyClass.java. I have a function defined in MyClass
Possible Duplicate: Java: “implements Runnable” vs. “extends Thread” When should you use: class MyThread

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.