I'm also having problems with the OnLongClickListener. I have it
attached to an ImageButton, but the event never fires.

On Mar 8, 7:54 am, babyblue <[EMAIL PROTECTED]> wrote:
> I can't make onLongClickListener work either. I just register it with
> a Button. No matter how long I hold it, no long click event happens.
>
> On 3月8日, 上午6时13分, condor <[EMAIL PROTECTED]> wrote:
>
> > I have a class of type LinearLayout that is an element of a list
> > view.
>
> > I am able to attach a click leastener but it is impossible to make a
> > longClick leastenre wroking.
>
> > It there any operation that must be done?
>
> > Here is extraction of the code of the cass
> > private class PeopleList extends LinearLayout {
>
> >                 private         CheckBox mCbContact;
> >                 private         View    mTheView;
> >                 private         Context         mContext;
> >                 private         int     mPositon=0;
>
> >  public PeopleList(Context context){
> >                 super(context);
> >                 Log.v(TAG,"PeopleList Constructor");
> >                 mContext = context;
> >                 ViewInflate inf
> > =(ViewInflate)getSystemService(INFLATE_SERVICE);
> >                 mTheView = inf.inflate(R.layout.contactlistrow, null, false,
> > null);
> >                 mTheView.setOnLongClickListener(mtheLongClickListener);
> >                 mCbContact = (CheckBox)
> > mTheView.findViewById(R.id.cbxSelectItem);
> >                 mCbContact.setOnClickListener(mCboxListener);
> >                 addView(mTheView, new LinearLayout.LayoutParams(
> >                     LayoutParams.FILL_PARENT,
> > LayoutParams.WRAP_CONTENT));
> >                 setOnLongClickListener(mtheLongClickListener);
> >                 setOnClickListener(mClickListener);
> >         }
>
> >         private OnClickListener mCboxListener = new OnClickListener()
> >         {
> >                 public void onClick(View v)
> >                 {
> >                         Log.v(TAG,"check box onClick: ");
> >                         if(mCbContact.isChecked()){
> >                                 
> > ((Contact)theContactList.get(mPositon)).Selected=true;
> >                         }
> >                         else
> >                         {
> >                                 
> > ((Contact)theContactList.get(mPositon)).Selected=false;
> >                         }
> >                 }
> >         };
>
> >         // NOT WORKING leastener
> >         private OnLongClickListener mtheLongClickListener = new
> > OnLongClickListener()
> >         {
> >                 public boolean onLongClick(View v)
> >                 {
> >                         Log.v(TAG,"Long Click: ");
> >                         return true;
> >                 }
> >         };
>
> >         // WORKING leastener
> >         private OnClickListener mClickListener = new OnClickListener()
> >         {
> >                 public void onClick(View v)
> >                 {
> >                         Log.v(TAG,"Short Click: ");
> >                         if(mCbContact.isChecked()){
> >                                 
> > ((Contact)theContactList.get(mPositon)).Selected=true;
> >                         }
> >                         else
> >                         {
> >                                 
> > ((Contact)theContactList.get(mPositon)).Selected=false;
> >                         }
> >                 }
> >         };
> >     }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to