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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:01:12+00:00 2026-05-22T22:01:12+00:00

i have this code but i can’t see the action when i click on

  • 0

i have this code but i can’t see the action when i click on a item from the list.
This code shows me the info on ArrayList profilesArrayList but i dont know how i check what item i am selecting form the listview. Anyone can help me?

profilesArrayList = new ArrayList<Profile>();
    profilesArrayList = copyProfilesToArrayList();
    ProfileAdapter adapter = new ProfileAdapter(
            getApplicationContext(), R.layout.profiles_item, profilesArrayList);

    listViewProfiles = (ListView)findViewById(android.R.id.list);
    listViewProfiles.setAdapter(adapter);

    listViewProfiles.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long id) {
            switch(position) {
            case 0:

                Log.d("cardNumber", profilesArrayList.get(0).getCardNumber());

                break;
  • 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-22T22:01:13+00:00Added an answer on May 22, 2026 at 10:01 pm

    If your container class for this code is the ListActivity, just override the onListItemClick for that class, rather than set it as an OnItemClickListener for the view. That works for me

    public class ProfileList extends ListActivity
    {
        private ArrayList<Profile> profilesArrayList;
        @Override 
        public void onCreate ( Bundle savedInstanceState )
        {
            super.onCreate(savedInstanceState);
            //populate your arraylist
    
            setListAdapter ( new ArrayAdapter<Profile>() );
        }
    
        @Override
        protected void onListItemClick(ListView l, View v, int position, long id)
        {
            super.onListItemClick(l, v, position, id);
            Log.d("cardNumber", profilesArrayList.get(position).getCardNumber());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code, which works fine, but I would like to be able
I have this piece of code I'm trying to get to display but no
I usually do not have difficulty to read JavaScript code but for this one
This is a really basic question but... I have some code like this var
There is probably is simple fix for this but I currently have code similar
I have a greasemonkey user script with this single line of code... window.close(); but
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
i have this code but i dont know what to do next.. var toBeInsertedToAS
Hey I have this code but it doesn't work because it is expecting a
I have this stadard code for receiving a class from a web service: function

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.