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

  • Home
  • SEARCH
  • 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 7619873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:47:57+00:00 2026-05-31T03:47:57+00:00

I have implemented an application with image view in my application i would like

  • 0

I have implemented an application with image view in my application i would like to implement when user move the image right side then i would like to get the next acitvity.
How can i write an event or any other code for move the image just right side?

I have used am imageView code as:

   (ImageView)findViewById(R.id.slide) //event for move right here

     Intent it = new Intent(Slide.this,NextActivity.class);
     startActivity(it);  

Please any body help me…

  • 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-05-31T03:47:59+00:00Added an answer on May 31, 2026 at 3:47 am

    So, if i understood you correctly, you want to move an ImageView across the screen, drag it, and when you hit a certain spot with it you want to start another activity?

    If so, you could try and use the code below…which let’s you drag your imageview across the screen

    Just add an onTouchListener to the imageView you’re trying to slide (move/drag)

    yourSlideImageViewObject.setOnTouchListener(new View.OnTouchListener() 
    {
              @Override
              public boolean onTouch(View v, MotionEvent event) 
              {
                    onSlideTouch(v, event);
                    return false;
              }
    });
    

    Then add this code to handle the Touch events

    public void onSlideTouch( View view, MotionEvent event )
    {
        //When the user pushes down on an ImageView
        if ( event.getAction() == MotionEvent.ACTION_DOWN )
        {
           inDragMode = true; //Set a variable so we know we started draggin the imageView
           //Set the selected ImageView X and Y exact position
           selectedImageViewX = Math.abs((int)event.getRawX()-((ImageView)view).getLeft());
           selectedImageViewY = Math.abs((int)event.getRawY()-((ImageView)view).getTop());
           //Bring the imageView in front
           ((ImageView)view).bringToFront();
        }
    
        //When the user let's the ImageView go (raises finger)
        if ( event.getAction() == MotionEvent.ACTION_UP )
        {
           inDragMode = false; //Reset the variable which let's us know we're not in drag mode anymore
        }
    
        //When the user keeps his finger on te screen and drags it (slides it)
        if ( event.getAction() == MotionEvent.ACTION_MOVE )
        {
            //If we've started draggin the imageView
            if ( inDragMode )
            {
                //Get the imageView object
                ImageView slide = (ImageView)findViewById(R.id.slide);
                //Get a parameters object (THIS EXAMPLE IS FOR A RELATIVE LAYOUT)
                RelativeLayout.LayoutParams params = RelativeLayout.LayoutParams)slide.getLayoutParams();
                //Change the position of the imageview accordingly
                params.setMargins((int)event.getRawX()-selectedImageViewX, (int)event.getRawY()-selectedImageViewY, 0, 0);
                //Set the new params
                slide.setLayoutParams(params);
    
                //If we hit a limit with our imageView position
                if( slideImageView_position is inside an interval )
                {
                    //Open another activity
                    Intent it = new Intent(Slide.this,NextActivity.class);
                    startActivity(it);
                }
            }
        }
    
    }
    

    The above should drag your imageview accross the screen.

    You can also implement in the MotionEvent.ACTION_MOVE event …. to limit the movement of the ImageView accross the screen. So check the new coordinates of your finger across the screen and check if they are out of bounds. If so, then do nothing. If they aren’t out of bounds, then change the left and upper margins of the ImaveView.

    Also, on the MotionEvent.ACTION_UP event, check to see if the left margin of the ImaveView is over a predefined limit (which means the user slided the imageView over you intended position). If so, you can continue doing whatever you want, which means starting an activity. OR, if you don’t want to open the activity while the user is dragging, not only after he has removed his finger from the imageView, then just do that if () i’ve written under the MotionEvent.ACTION_MOVE event. Insert there the interval you want, so when the imageView is dragged inside that interval, the activity starts.

    If you’re confused, please ask 🙂 It’s very late here, and i’m tired, so i might have not explained it properly 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a TTPickerTextField in my application, I would like to limit the
I have implemented an application for get the images from external storage when user
I have implemented an application with image. In my application I have used on
I have successfully implemented embedded vimeo videos into my app, however i would like
I have to implement a application which displays a grid view of thubmnails each
I have implement one application in which four image button and on image button
I have an image I am displaying to a user in my android application.
I have images in my iphone application I would like to summon when needed.
I have implemented an application with multiple check boxes with multiple layouts.I am invisible
I have implemented an application for modify the xml layout with some properties. I

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.