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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:09:33+00:00 2026-06-11T16:09:33+00:00

i am trying to add an OnItemClickListener to a coverflow app for android, one

  • 0

i am trying to add an OnItemClickListener to a coverflow app for android, one where the images can scroll back and forth and the part i wanted to add was an on click listener so you can click on one of the images and go to another activity. i am guessing that it works the same way you would if you were adding an OnItemClick to a listview or a gridview filled with images. I understand that this question has been asked before, however this case is different. there is additional code in the app that does not make sense. here is where the code comes from http://www.inter-fuser.com/2010/01/android-coverflow-widget.html and this app has the following four java classes:

CoverFlow.java // extends CoverAbsSpinner and implements GestureDetector.OnGestureListener

CoverAdapterView.java // class extends Adapter and ViewGroup classes

CoverAbsSpinner.java // this class extends CoverAdapterView.java

CoverFlowExample.java // extends Activity

and the strange thing is this code shown below that i found in the CoverAdapterView.java class. it does not make sense to place what looks like a useless interface stuck in the middle of the class. and it says “Callback method to be invoked when an item in this AdapterView has been clicked.”

this is the mystery of the method. how do you “call” this? did they actually prepare the OnItemClickListener? do i override this thing or what?

and for the reason of this code in not yet understood? anyone know what the purpose of this is? it is an interface that you have to implement or override anyway. so i question the purpose of this.

public interface OnItemClickListener {

    /**
     * Callback method to be invoked when an item in this AdapterView has
     * been clicked.
     * <p>
     * Implementers can call getItemAtPosition(position) if they need
     * to access the data associated with the selected item.
     *
     * @param parent The AdapterView where the click happened.
     * @param view The view within the AdapterView that was clicked (this
     *            will be a view provided by the adapter)
     * @param position The position of the view in the adapter.
     * @param id The row id of the item that was clicked.
     */
    void onItemClick(CoverAdapterView<?> parent, View view, int position, long id);


}
/**
 * Register a callback to be invoked when an item in this AdapterView has
 * been clicked.
 *
 * @param listener The callback that will be invoked.
 */
public void setOnItemClickListener(OnItemClickListener listener) {
    mOnItemClickListener = listener;
}

/**
 * @return The callback to be invoked with an item in this AdapterView has
 *         been clicked, or null id no callback has been set.
 */
public final OnItemClickListener getOnItemClickListener() {
    return mOnItemClickListener;
}

/**
 * Call the OnItemClickListener, if it is defined.
 *
 * @param view The view within the AdapterView that was clicked.
 * @param position The position of the view in the adapter.
 * @param id The row id of the item that was clicked.
 * @return True if there was an assigned OnItemClickListener that was
 *         called, false otherwise is returned.
  • 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-11T16:09:34+00:00Added an answer on June 11, 2026 at 4:09 pm

    Hi for coverflow click listner try to use this.

    coverFlow.setOnItemClickListener(new OnItemClickListener() 
    {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) 
        {
            switch(position) 
            {
                case 0:
                    startActivity(new Intent(****.this,@@@@.class));
                    finish();
                    break;
                case 1:
                    startActivity(new Intent(****.this, ####.class));
                    finish();
                    break;
                case 2:
                    startActivity(new Intent(****.this, &&&&.class));
                    finish();
                    break;
    
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please, I've been trying to add ListView to the android app am developing but
I'm trying to set an OnItemClickListener for my ListView in Android, but i can't
Trying to add a blank sample app for a rails tutorial to GitHub, but
Trying to add email notification to my app in the cleanest way possible. When
Trying to add a dynamic class value to one of my columns in CGridView:
I am trying to create one android application using gridView. In this application I
I am trying to create app which is match text with appropriate images by
I'm new in android.I'm using listview which contains images and textview.I want to add
Im trying to add a number to the classes hand . Each one of
Trying to add django-registration to my app. I have installed setup tools to use

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.