hi Tom,

I encountered the same problem you had.  Did you find the solution to
the problem?

thanks,
andy


On Jun 3, 7:01 am, Tom <[email protected]> wrote:
> Ok first in my row.xml I had :
>  - a TextView with the attribute "android:telephone"
> When I remove this attribute, the item can beselectedwith the mouse.
>
>  - a CheckBox :
>     <CheckBox android:id="@+id/user_check"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"/>
>
> When I remove this CheckBox,itemsare selectable and clickable.
>
> I'm looking for what is blocking.
> Best regards
> Tom
>
> On 3 juin, 15:25, guna <[email protected]> wrote:
>
> > Then Check the xml.... Remove unnecessary attributes........
>
> > On Wed, Jun 3, 2009 at 6:37 PM, guna <[email protected]> wrote:
> > >  getListView().setItemsCanFocus(true);
>
> > > Change to true as like this... it will work then
>
> > > On Wed, Jun 3, 2009 at 6:23 PM, Tom <[email protected]> wrote:
>
> > >> public class UserList extends ListActivity implements
> > >> AdapterView.OnItemClickListener{
>
> > >>        private Client client;
> > >>        private ArrayList<User> users = new ArrayList<User>();
> > >>        private UserAdapter userAdapter;
>
> > >>     @Override
> > >>    public void onCreate(Bundle savedInstanceState) {
> > >>        super.onCreate(savedInstanceState);
> > >>        setContentView(R.layout.user_list);
> > >>         getListView().setItemsCanFocus(false);
> > >>        getListView().setOnItemClickListener(this);
>
> > >>        Intent i = getIntent();
> > >>        if (i!= null)
> > >>        {
> > >>                if (i.getAction().equalsIgnoreCase(Intent.ACTION_VIEW))
> > >>                {
> > >>                this.client = (Client) i.getSerializableExtra
> > >> (Constants.CLIENT_CLASS_NAME);
>
> > >>                this.userAdapter = new UserAdapter(this,
> > >> R.layout.user_row, users);
>
> > >>                users = (ArrayList<User>) this.client.getUsers();
>
> > >>                 Log.i(getClass().getSimpleName(),"Display users");
> > >>                 for(int j=0;j<users.size();j++)
> > >>                {
> > >>                        this.userAdapter.add(users.get(j));
> > >>                }
> > >>                setListAdapter(this.userAdapter);
>
> > >>                }
> > >>        }
> > >>    }
>
> > >>     @Override
> > >>    public void onItemClick(AdapterView<?> adapterView, View view, int
> > >> position, long id)
> > >>    {
> > >>        Log.d(getClass().getSimpleName(), " -- Click -- ");
> > >>    }
>
> > >>    // Adapter
> > >>     private class UserAdapter extends ArrayAdapter<User> {
>
> > >>        private LayoutInflater mInflater;
> > >>        private ArrayList<User>items;
>
> > >>        public UserAdapter(Context context, int resourceId,
> > >> ArrayList<User>items)
> > >>        {
> > >>            super(context, resourceId,items);
> > >>            mInflater = LayoutInflater.from(context);
> > >>            this.items=items;
> > >>        }
>
> > >>        public boolean areAllItemsSelectable()
> > >>        {
> > >>            return true;
> > >>        }
>
> > >>        public boolean isEnabled(int position) {
> > >>            if (position >= 0 && position <=items.size()) {
> > >>                return true;
> > >>            }
> > >>            return false;
> > >>        }
>
> > >>        public int getCount() {
> > >>            returnitems.size();
> > >>        }
>
> > >>        public User getItem(int position) {
> > >>              if (0 == position) {
> > >>                  return null;
> > >>              }
> > >>              returnitems.get(position);
> > >>         }
>
> > >>       �...@override
> > >>        public View getView(int position, View convertView, ViewGroup
> > >> parent) {
>
> > >>            ViewHolder holder = null;
> > >>            View v = convertView;
> > >>            User user =items.get(position);
>
> > >>            if (v == null) {
> > >>                mInflater = (LayoutInflater)getSystemService
> > >> (Context.LAYOUT_INFLATER_SERVICE);
> > >>                v = mInflater.inflate(R.layout.user_row, null);
>
> > >>                    if (user != null) {
> > >>                        // Creates a ViewHolder and store references to 
> > >> the
> > >> two children views
> > >>                        // we want to bind data to.
> > >>                        holder = new ViewHolder();
> > >>                        holder.firstNameText = (TextView) v.findViewById
> > >> (R.id.user_first_name);
> > >>                        holder.lastNameText = (TextView) v.findViewById
> > >> (R.id.user_last_name);
> > >>                        holder.phoneNumberText = (TextView) v.findViewById
> > >> (R.id.user_phone_number);
> > >>                        holder.statusText = (TextView) v.findViewById
> > >> (R.id.user_status);
> > >>                    }
>
> > >>                    v.setTag(holder);
> > >>            }
> > >>                else
> > >>                {
> > >>                holder = (ViewHolder) v.getTag();
> > >>                }
>
> > >>            if (holder.firstNameText != null) {
> > >>                holder.firstNameText.setText(user.getFirstName());
> > >>            }
> > >>            if (holder.lastNameText != null){
> > >>                holder.lastNameText.setText(user.getLastName());
> > >>            }
> > >>            if ( holder.phoneNumberText != null){
> > >>                 holder.phoneNumberText.setText(user.getPhoneNumber());
> > >>            }
> > >>            if (holder.statusText != null){
> > >>                holder.statusText.setText(String.valueOf(user.getStatus
> > >> ()));
> > >>            }
>
> > >>            return v;
> > >>        }
>
> > >>         class ViewHolder {
> > >>            TextView firstNameText;
> > >>            TextView lastNameText;
> > >>            TextView phoneNumberText;
> > >>            TextView statusText;
> > >>        }
>
> > >>        public long getItemId(int position) {
> > >>            return position;
> > >>        }
>
> > >>    }
>
> > >> On 3 juin, 13:35, guna <[email protected]> wrote:
> > >> > Post your latest code... So that its easy to correct the errors....
> > >> Check
> > >> > whether enabled the listitems.....
>
> > >> > On Wed, Jun 3, 2009 at 4:59 PM, Tom <[email protected]> wrote:
>
> > >> > > I added to my class "implements AdapterView.OnItemClickListener".
> > >> > > Then I implemented "onItemClickListener" method and added in
> > >> > > "onCreate" "setOnClickListener(this)".
>
> > >> > > Now I can select and highlightitemsbut only with the trackball.
> > >> > > Nothing happens with the mouse event.
>
> > >> > > On 3 juin, 13:23, guna <[email protected]> wrote:
> > >> > > > Ask clearly your questions........
>
> > >> > > > On Wed, Jun 3, 2009 at 4:45 PM, Tom <[email protected]>
> > >> wrote:
>
> > >> > > > > I just want to notice that the Layout for the ArrayAdapter
> > >> contains
> > >> > > > > checkbox.
>
> > >> > > > > On 3 juin, 11:33, Tom <[email protected]> wrote:
> > >> > > > > > Ok
> > >> > > > > > I added to my class "implements
> > >> AdapterView.OnItemClickListener".
> > >> > > > > > Then I implemented "onItemClickListener" method and added in
> > >> > > > > > "onCreate" "setOnClickListener(this)".
>
> > >> > > > > > Now I can select and highlightitemsbut only with the
> > >> trackball.
> > >> > > > > > Nothing happens with the mouse event.
>
> > >> > > > > > May have implement "OnItemSelectedListener" too ?
>
> > >> > > > > > Thanks
> > >> > > > > > Tom
>
> > >> > > > > > On 2 juin, 16:47, guna <[email protected]> wrote:
>
> > >> > > > > > > Tom,
>
> > >> > > > > > > You didnt implements OnItemClickListener, and also in 
> > >> > > > > > > oncreate
> > >> add
> > >> > > > > > > setonitemclicklistener(this)....
>
> > >> > > > > > > On Tue, Jun 2, 2009 at 8:10 PM, Tom <[email protected]>
> > >> > > wrote:
>
> > >> > > > > > > > These are my line of codings :
>
> > >> > > > > > > > public class UserList extends ListActivity{
>
> > >> > > > > > > >    private Client client;
> > >> > > > > > > >    private ArrayList<User> users = new ArrayList<User>();
> > >> > > > > > > >    private UserAdapter userAdapter;
> > >> > > > > > > >    public static final int MENU_ITEM_VIEW = Menu.FIRST;
> > >> > > > > > > >    private static final int COLUMN_INDEX_TITLE = 1;
>
> > >> > > > > > > >   �...@override
> > >> > > > > > > >    public void onCreate(Bundle savedInstanceState) {
> > >> > > > > > > >        super.onCreate(savedInstanceState);
> > >> > > > > > > >        setContentView(R.layout.user_list);
>
> > >> > > > > > > >        Intent i = getIntent();
> > >> > > > > > > >        if (i!= null)
> > >> > > > > > > >        {
> > >> > > > > > > >                if
> > >> > > > > (i.getAction().equalsIgnoreCase(Intent.ACTION_VIEW))
> > >> > > > > > > >                {
> > >> > > > > > > >                this.client = (Client) 
> > >> > > > > > > > i.getSerializableExtra
> > >> > > > > > > > (Constants.CLIENT_CLASS_NAME);
>
> > >> > > > > > > >                this.userAdapter = new UserAdapter(this,
> > >> > > > > > > > R.layout.user_row, users);
> > >> > > > > > > >                users = (ArrayList<User>)
> > >> this.client.getUsers();
> > >> > > > > > > >                for(int j=0;j<users.size();j++)
> > >> > > > > > > >                {
> > >> > > > > > > >                        this.userAdapter.add(users.get(j));
> > >> > > > > > > >                }
> > >> > > > > > > >                setListAdapter(this.userAdapter);
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to