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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:40:04+00:00 2026-06-10T03:40:04+00:00

I am creating a android application. Here I have a imageview . my goal

  • 0

I am creating a android application.
Here I have a imageview .
my goal is to get next picture from database when move the finger on image

float nPicturePositionM = 0;

public boolean onTouch(View v, MotionEvent event) {
    boolean aHandledL = false;
    if (event.getAction() == MotionEvent.ACTION_MOVE) {
        float nNewPicturePosL = event.getX();
        if (nPicturePositionM < nNewPicturePosL) {
            nPicturePositionM = nNewPicturePosL;
            GetPictures(true);
        } else {
            nPicturePositionM = nNewPicturePosL;
            GetPictures(false);
        }
        aHandledL = true;
    }

    return aHandledL;

    //return false;
}

How can i handle it using touch event? Image should slide as in we do it in gallery

  • 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-10T03:40:06+00:00Added an answer on June 10, 2026 at 3:40 am

    Firstly you declare an imageview in your xml :

    <ImageView
        android:id="@+id/imageview1"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="45dp"
        android:layout_centerHorizontal="true" />
    

    Then in your activity you initialize the component :

    private ImageView image1;

    In onCreate :

    this.image1= (ImageView)this.findViewById(R.id.imageview1);
    this.image1.setImageResource(R.drawable.NAMEOFIMAGE);
    

    The next step is detecting if the image is “clicked”. You can then use an online database or an SQLite database to save the images or the path to the images, the database part of it is a large part to teach from scratch depending which route you want to go with:

           this.image1.setOnClickListener(new View.OnClickListener() {        
            @Override
               public void onClick(View view) {
                if (view == findViewById(R.id.imageview1)) {     
                             //PUT IN CODE HERE TO GET NEXT IMAGE
                }
                }
            });
    

    I hope this helps. Let me know how it goes 🙂

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

Sidebar

Related Questions

I'm trying to record sound by creating an android application. here is the code:
I'm creating an android application which should parse a Json from a file or
I'm creating an Android application that requires the following: Data from RSS feed gets
I am creating an android application using Java. I have a boolean variable called
If an application have to support starting from android 1.6 device and onwards. The
Hi i am developing android application. I that i have creating the dynamic table
Hi i am developing android application, And now i have to use sqlite database
I am creating an application where I am calling my database from a different
I am creating an android application in flash builder 4 using 4.1 SDK on
I am creating an android application in which I am using table layout in

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.