Note that there are some explanatory texts on larger screens.

plurals
  1. POI can't click the ListView in android?
    primarykey
    data
    text
    <p>I made an app using contact sync. I list the following contact info with photo, name and number. I successfully list all those things in a custom <strong>ListView</strong>, but I can't click the <strong>ListView</strong>. It looks like locked, Unable to click it. </p> <p>But I made a same procedure to another activity. Using custom <strong>ListView</strong> but I can click this view and it works fine. </p> <p>What is the problem? here is my sample coding:</p> <pre><code> ListView settingsList = (ListView) findViewById(R.id.manage_track_listView); ArrayList&lt;ContactList&gt; MySettingsList = new ArrayList&lt;ContactList&gt;(); ContactList setting1 = new ContactList("contact name 1", "Number 1", null); ContactList setting2 = new ContactList("contact name 2", "Number 2", null); ContactList setting3 = new ContactList("contact name 3", "Number 3", null); MySettingsList.add(setting1); MySettingsList.add(setting2); MySettingsList.add(setting3); ContactList list[] = new ContactList[MySettingsList.size()]; for(int i=0;i&lt;MySettingsList.size();i++) { ContactList mySettings = MySettingsList.get(i); list[i] = new ContactList(mySettings.getName(), mySettings.getNumber(), mySettings.getImageIcon()); } ContactListAdapter adapter = new ContactListAdapter(this, R.layout.manage_track_list_custom_view, list); settingsList.setAdapter(adapter); System.out.println("before listener"); settingsList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // TODO Auto-generated method stub System.out.println("Clicked " + position); } }); System.out.println("after listener"); </code></pre> <p>Here ContactList is a class which has contact name, number, and byte[] for imageBlob. If the image is null I set the default ic_launcher as a contact image. The adapter class is: </p> <pre><code>public class ContactListAdapter extends ArrayAdapter&lt;ContactList&gt; { Context context; int layoutResourceId; ContactList objects[] = null; View row; public ContactListAdapter(Context context, int layoutResourceId, ContactList[] objects) { super(context, layoutResourceId, objects); // TODO Auto-generated constructor stub this.context = context; this.layoutResourceId = layoutResourceId; this.objects = objects; System.out.println(objects[1].getName()); System.out.println(objects[1].getNumber()); System.out.println(objects[1].getImageIcon()); } @Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub row = convertView; final ContactListHolder holder; if ( row == null ) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new ContactListHolder(); holder.image = (ImageView) row.findViewById(R.id.contactImage); holder.name = (TextView) row.findViewById(R.id.contactName); holder.number = (TextView) row.findViewById(R.id.contactNumber); holder.check = (CheckBox) row.findViewById(R.id.selectedContact); row.setTag(holder); } else { holder = (ContactListHolder)row.getTag(); } ContactList contact = objects[position]; if(contact.imageIcon != null) { Bitmap imgBitmap = BitmapFactory.decodeByteArray(contact.imageIcon, 0, contact.imageIcon.length); holder.image.setImageBitmap(imgBitmap); } else { holder.image.setImageResource(R.drawable.ic_launcher); } holder.name.setText(contact.name); holder.number.setText(contact.number); holder.check.setChecked(objects[position].isSelected()); return row; } static class ContactListHolder { ImageView image; TextView name; TextView number; CheckBox check; } } </code></pre> <p>I Have more than 100 contacts so added only 3 objects. In this contact list I successfully receive contact image, name, number.</p> <p>What is the problem the <strong>ListView</strong> is unable to click? I hope any one of u will guide me. Thanks in advance.</p> <hr> <p>Thanks to all. now got the result by just adding <code>android:focusable="false"</code> in my all child views. thanks for ur guidings.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload