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 8415069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:20:26+00:00 2026-06-10T01:20:26+00:00

I have a customized OnTouch Method where i check if the touch coordinates contains

  • 0

I have a customized OnTouch Method where i check if the touch coordinates contains a rectangle.After checking the condition i want to start a new Activity.But unfortuanlely its not workin.Can someone help me out?

public class custom extends SurfaceView implements SurfaceHolder.Callback{


public boolean onTouchEvent(MotionEvent event) {
    int touchX = (int) event.getX();
    int touchY = (int) event.getY();
    switch(event.getAction()){

    case MotionEvent.ACTION_DOWN:
            System.out.println("Touching down!");

            for(int i =0; i< rectangles.size();i++){

                if(rectangles.get(i).contains(touchX,touchY)){
                    System.out.println("Touched Rectangle, start activity.");
                    rectangles.get(i).describeContents ();
                    Selected_rect = String.valueOf(rectangles.get(i));
                                       }
                Intent intent=new Intent(getContext(), DetectBlock.class);  
                startActivity(intent); //ERROR >> Start activity undefined   

            }
            break;
    case MotionEvent.ACTION_UP:
            System.out.println("Touching up!");
            break;
    case MotionEvent.ACTION_MOVE:
            System.out.println("Sliding your finger around on the screen.");
            break;
    }
    return true;
}
}
  • 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-10T01:20:27+00:00Added an answer on June 10, 2026 at 1:20 am

    I found the answer 🙂

    private void startActivity() {
        // TODO Auto-generated method stub
        Intent myIntent = new Intent("android.intent.action.DetectBlock");
        myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        getContext().startActivity(myIntent);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have customized the UIAlertView class. It's working perfectly. I don't want the bounce
I have customized UITableViewCell (Static Content Loaded from nib). This cell contains one UILable
I have customized a UITableViewCell and I want to implement swipe to delete. But
i have this customized list. each row contains an image and two lines of
In my magento project the search result not displays. I have customized my magento.
I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I have a customized version of SDL 1.2 and pygame 1.9.1 that implement SDL2's
Currently I have a customized people picker in sharepoint 2010, it searches the search
I am using SharePoint 2010 and have a customized newform.aspx and editform.aspx that I
Is is possible ot configure Chainsaw to read log files that have been customized

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.