Hi , thanks for your reply.
Unfortunately , I am not using ListActivity, instead , it is normal
Activity with a ListView.
By the way , I have solved the problem by adding the onClicklistener
in the getView() of the custom Adapter.
@Override
public View getView(int position, View convertView, ViewGroup
parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi =
(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.select_answer_row, null);
v.setClickable(true);
v.setOnClickListener(flipPrevious);
}
// Do something
}
Thanks for your guide ... appreciate.
On Jul 27, 4:20 pm, Mark Murphy <[email protected]> wrote:
> On Tue, Jul 27, 2010 at 4:13 AM, CG <[email protected]> wrote:
> > Thanks for the reply , I have tried to add onClickListener to a
> > ListView but it throws exception to ask me to use onItemClickListener
> > instead .
>
> Correct.
>
>
>
> > I try with onItemClickListener but it does not seems to trigger ... ,
> > I am using a custom Adapter.
>
> > mListViewSelection.setOnItemClickListener(new
> > AdapterView.OnItemClickListener() {
>
> > �...@override
> > public void onItemClick(AdapterView<?> arg0,
> > View arg1,
> > int arg2, long arg3) {
>
> > // DO SOMETHING
> > }
>
> > });
>
> > In my custom adapter layout. it contains 1 imageview, 2 textview in a
> > linearlayout. Focusable & Clickable for imageview and both textview
> > have been set to "false". Is this the correct way ?
>
> You should not touch the focusable and clickable attributes of
> ImageView or TextView -- the defaults are what you want.
>
> If your activity is a ListActivity, you could override
> onListItemClick() in the activity, instead of using
> setOnItemClickListener().
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 2.9 Available!
--
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