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

The Archive Base Latest Questions

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

my class extends Activity, not ListActivity. i have this code on create method but

  • 0

my class extends Activity, not ListActivity. i have this code on create method but i select an item from the list, the background of it dont stay orange. I have to move the arrows in the emulator for down to navigate on the listview.

When i click on the button center on the emulator, the log dont show the message.

I tired of try many thinks and i still without get the action when i select one item from the list.
Any sugestions?? thanks a lot

      final List<Profile> profilesList = getProfilesList();
  ProfileArrayAdapter3 adapter = new ProfileArrayAdapter3(
        getApplicationContext(), R.layout.profiles_item, profilesList);
  listViewProfiles = (ListView) this.findViewById(R.id.profilesList);

  listViewProfiles.setAdapter(adapter);
  listViewProfiles.setOnItemClickListener(new OnItemClickListener() {

     @Override
     public void onItemClick(AdapterView<?> a, View v, int position, long id) {
        Toast.makeText(getApplicationContext(), profilesList.get(position).getCardNumber(), Toast.LENGTH_SHORT).show();
        Log.d("cardNumber",profilesList.get(position).getCardNumber());
     }});
  • 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:23:44+00:00Added an answer on May 22, 2026 at 10:23 pm

    Personnaly, I prefer to use click listeners on my view than using a itemclicklistener on the list itself. Click listeners on views can be shared, and you will get the source of the event using the parameter of onClick.

    Here is an example :

    private SharedClickListener sharedListener = new SharedClikListener();
    
    private class MovieArrayAdapter extends ArrayAdapter<Movie>
    {
        public MovieArrayAdapter()
        {
            super(getApplicationContext(), R.layout.profiles_item, profilesList);
        }//cons
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
                        //you should build your own views here and fill them with
                        //a profile object, here I use super to compile the example
                        View view = super.getView(position, convertView, parent );
                        view.setOnClickListener( sharedListener );
            return view;
        }//met
    }//inner class
    
    private class ItemClickListener implements View.OnClickListener {
    
        @Override
        public void onClick(View v) {
            Toast.makeText(getApplicationContext(), ((your view class)v).getProfile().getCardNumber(), Toast.LENGTH_SHORT).show();
        Log.d("cardNumber",((your view class) v).getProfile().getCardNumber()); 
            }// met
    }//inner class
    

    Regards,
    Stéphane

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

Sidebar

Related Questions

Lets say I have the following code: abstract class Animal case class Dog(name:String) extends
I have: class MyClass extends MyClass2 implements Serializable { //... } In MyClass2 is
I saw in the apache camel source code that public class DefaultCamelContext extends ServiceSupport
I have a few classes such that: public class XMLStatusMessage extends XMLMessage {} public
I have two Java classes: B, which extends another class A, as follows :
If I have a base class such that public abstract class XMLSubscription <T extends
Currently I have a class that is extending the ListActivity class. I need to
I have an activity which shows some List entries. When I click on a
I am trying to create a simple Icon+Text ListView but it does not work.
Android:How to display images from the web in a ListView?I have the following code

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.