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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:06:38+00:00 2026-06-05T12:06:38+00:00

this is my code to display listview in customized format .but my requirement is

  • 0

this is my code to display listview in customized format .but my requirement is when ever i clicked on any of the item of listview its further details need to be displayed but when am clicking on it ….its not at all getting effected i mean no setonitemclicklictener event is performed ….
i request please have a look on my code which is given above ….thanks to all

package com.hands;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class Passengers extends Activity implements OnClickListener{
     ListView lview3; 
     Button btn;        
     int textlength = 0;
        ArrayList<String> text_sort = new ArrayList<String>();
        ArrayList<Integer> image_sort = new ArrayList<Integer>();
        ArrayList<String> text_sort2 = new ArrayList<String>();
    EditText edittext;
        private static String month[] = {"kareem","Saleem","Imran","Anwar","Shahid",  
                                               "Raheem","Afzal","Nazeer","Ahmed"};  

        private static String desc[] = {"ssagi123,Indian","ssagi1234,Indian","ssagi1235,Indian",  
                      "ssagi1236,Indian","ssagi1237,Indian","ssagi1238,Indian","ssagi1239,Indian",  
                                          "ssagi12310,Indian","ssagi123411,Indian","Month - 10"};  
       int[] image = { R.drawable.user2, R.drawable.user2, R.drawable.user2,
                R.drawable.user2, R.drawable.user2, R.drawable.user2, R.drawable.user2,
                R.drawable.user2, R.drawable.user2, R.drawable.user2 };

    /*   private static String bstatus[] = {"no status","no status","no status","no status","no status",  
           "no status","no status","no status","no status"};  

        */
    @Override
      protected void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                setContentView(R.layout.passengers);
                System.out.println("****1");
                btn=(Button)findViewById(R.id.psnbutt1);
                btn.setOnClickListener(this);
                edittext = (EditText) findViewById(R.id.search_mycontact);
                lview3 = (ListView) findViewById(R.id.listView3);  
                 System.out.println("****2");
                lview3.setAdapter(new ListViewCustomAdapter(image, month, desc));

                edittext.addTextChangedListener(new TextWatcher()
                 {

                public void afterTextChanged(Editable s)
                 {

                 }

               public void beforeTextChanged(CharSequence s, int start,
                 int count, int after)
                 {

                 }
             public void onTextChanged(CharSequence s, int start,
                  int before, int count)
                  {

                textlength = edittext.getText().length();
                text_sort.clear();
                image_sort.clear();
                text_sort2.clear();

                for (int i = 0; i < month.length; i++)
                {
                if (textlength <= month[i].length())
                {
                if (edittext.getText().toString().
                equalsIgnoreCase((String) month[i].subSequence(0, textlength)))
                {
                text_sort.add(month[i]);
                image_sort.add(image[i]);
                text_sort2.add(desc[i]);
                }
                }
                }

                System.out.println("****3");
                lview3.setAdapter(new ListViewCustomAdapter(image_sort, text_sort, text_sort2));
                }
                });
                System.out.println("****4");

           lview3.setOnItemClickListener(new OnItemClickListener() {
           public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                      System.out.println("****5");

                   // Object listItem = lview3.getItemAtPosition(position);
                //String keyword=listItem.toString();
              //  Toast.makeText(getApplicationContext(), "you are selected"+keyword, Toast.LENGTH_LONG).show();


                } 
             });

        }

          class ListViewCustomAdapter extends BaseAdapter  
                {  
                   String[] title;  
                   String[] description;
                   int[] number;
                  Activity context;  
                   LayoutInflater inflater;  

                  ListViewCustomAdapter()
                  {

                  }
                  ListViewCustomAdapter(int[] image, String[] month, String[] desc)
                  {
                      title = month;
                      description=desc;
                      number=image;

                  }
                  ListViewCustomAdapter(ArrayList<Integer> image,ArrayList<String> month, ArrayList<String> desc)
                  {
                  title = new String[month.size()];
                  description=new String[desc.size()];

                  number = new int[image.size()];

                  for(int i=0;i<month.size();i++)
                  {
                  title[i] = month.get(i);
                  description[i]=desc.get(i);
                  number[i] = image.get(i);

                  }

                  }



                  @Override
                  public int getCount() {
                      // TODO Auto-generated method stub
                      return title.length;
                  }


                  @Override
                  public Object getItem(int position) {
                      // TODO Auto-generated method stub
                      return null;
                  }
                  @Override
                  public long getItemId(int position) {
                      // TODO Auto-generated method stub
                      return position;
                  }


                  @Override
                  public View getView(int position, View convertView, ViewGroup parent) {
                      LayoutInflater inflater = getLayoutInflater();
                      View row=convertView;
                      row = inflater.inflate(R.layout.listitem_row2, parent, false);
                    TextView textview = (TextView) row.findViewById(R.id.txtViewTitle);
                    TextView textview1 = (TextView) row.findViewById(R.id.txtViewDescription);
                    System.out.println("before list row statement");
                    //final ListView lview3=(ListView) row.findViewById(R.id.listView3);
                    // final ListView lview3=(ListView)findViewById(R.id.listView3);
                    System.out.println("after list row statement");
                    ImageView imageview = (ImageView) row.findViewById(R.id.imgViewLogo);
                    textview.setText(title[position]);
                    textview1.setText(description[position]);
                    imageview.setImageResource(number[position]);

                        /*lview3.setOnItemClickListener(new OnItemClickListener() {

                                public void onItemClick(AdapterView<?> adapter, View view, int position, long arg) {


                             Object listItem = lview3.getItemAtPosition(position);
                                String keyword=listItem.toString();
                                Toast.makeText(getApplicationContext(), "you are selected"+keyword, Toast.LENGTH_LONG).show();


                                } 
                             });

                */
                    return (row);
                     }
                 }    
                  public void onClick(View v) {
                     // TODO Auto-generated method stub
                         switch (v.getId()) {
                  case R.id.psnbutt1:
                            Intent i = new Intent(this, NewhapploginActivity.class);  
                            startActivity(i);
                             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-06-05T12:06:39+00:00Added an answer on June 5, 2026 at 12:06 pm

    You need to add

    android:focusable="false"
    android:focusableInTouchMode="false"
    

    to all the View’s of your row.xml.Because in Custom ListView as the View over it are having the focus so ListView is not able to get its focus working.

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

Sidebar

Related Questions

I have this below code access the ListView item value into string and display
I have this Code to Capture a image and Display it back in ListView
Im trying to display this listview, but I keep getting a: 07-17 21:14:22.233: ERROR/AndroidRuntime(349):
Following s my Code to display data to listview from database. But it will
With this code: <ul data-role=listview id=routelist data-theme=g> <li id=firstlistitem style=display:none;> $(<li><a href='http://www.google.co.uk'></a></li>).text('content').insertAfter($(#firstlistitem)); and see
I am using this code to display a grid $('#table1 tr').bind('click', shows); function shows()
I have this code: def display(self): print self.doc.toprettyxml(indent= ) strigName ='/Users/my_user/Desktop/python/' + str(datetime.datetime.now()) +
I have this code to display the data retrieved from DB in accounts_view.php :
This code lets me display/hide a custom message msg_one msg_two msg_three when the appropriate
I have this code which can display drop down in div tag of html.

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.