Hi!

I haven't seen your code, but have you tried using a GestureDetector?
(see 
http://developer.android.com/reference/android/view/GestureDetector.OnGestureListener.html)
Using the method onTouchEvent + a gestureDetector, you can be able of
detecting a simple click, a long click, or even a fling, so you can
implement the drag and drop easily.

On Mar 18, 10:15 am, varinag gold <varinagg...@gmail.com> wrote:
> Below is the code:
>
>  OnItemClickListener listener1 = new OnItemClickListener() {
>
>               @Override
>               public void onItemClick(AdapterView<?> parent, View
> view,
>                       int position, long id) {
>                   Log.d(TAG1, "OnItemClickListener");
>
>                   final String message = "OnTouchGrid:Icon No." + id+" is
> Touched.";
>                    Toast.makeText(myCardList.this, message,
> Toast.LENGTH_SHORT).show();
>
>               }
>           };
>           mGrid.setClickable(true);
>           mGrid.setOnItemClickListener(listener1);
>
>  OnItemLongClickListener listener2 = new OnItemLongClickListener() {
>
>                       @Override
>                       public boolean onItemLongClick(AdapterView<?> parent,
> View view,
>                               int position, long id) {
>                         Log.i(TAG1, "OnItemLongClickListener");
>
>                           final String message = "OnLongTouchGrid:Icon No." + 
> id
> +" is Touched.";
>                                 Toast.makeText(myCardList.this, message,
> Toast.LENGTH_SHORT).show();
>                           return true;
>                       }
>                   };
>                   mGrid.setLongClickable(true);
>                   mGrid.setOnItemLongClickListener(listener2);
>
> Here is what I tried but found its not working when I implement both
> onItemClickListener and onItemClickLongListener then only
> onItemClickLongListener works and onItemClickListener doesn't work. If
> I just implement onItemClickListener it works but with
> onItemClickListener.
> Any Idea?
>
> Regards,
> varinag
>
> On Mar 17, 12:55 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
>
> > There is a long item click listener in grid view - you do know that, right?
> > 17.03.2011 4:30 пользователь "varinag gold" <varinagg...@gmail.com> написал:
>
> > > I want to activate a drag and drop function once a user long press the
> > > GridView items.
> > > I am not sure if OnCreateContextMenuListener and handle it
> > > straightforwardly.
>
> > > Thanks,
> > > Varinag
>
> > > On Mar 17, 1:20 am, Justin Anderson <magouyaw...@gmail.com> wrote:
> > >> Are you just wanting to display a context menu with the long press?  If
> > so
> > >> you can implement OnCreateContextMenuListener and use
> > >> setOnCreateContextMenuListener()
>
> > >>http://developer.android.com/reference/android/view/View.html#setOnCr...
>
> > >> Thanks,
> > >> Justin Anderson
> > >> MagouyaWare Developerhttp://sites.google.com/site/magouyaware
>
> > >> On Wed, Mar 16, 2011 at 12:41 AM, varinag gold <varinagg...@gmail.com
> > >wrote:
>
> > >> > Any one?
>
> > >> > On Mar 15, 4:38 pm, varinag gold <varinagg...@gmail.com> wrote:
> > >> > > Hello,
>
> > >> > > For a gridview I am able to set the onItemClick and it works fine but
> > >> > > I don't know how should I implement  "onItemLongClick" so that I can
> > >> > > get both type of responses from a gridview items.
>
> > >> > > I googled but could'n get an understandable code where both have been
> > >> > > implemented properly.
>
> > >> > > Please respond if you have done it .
>
> > >> > > Regards,
> > >> > > varinag
>
> > >> > --
> > >> > 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
> > >> > android-developers+unsubscr...@googlegroups.com
> > >> > For more options, visit this group at
> > >> >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > 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
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
>

-- 
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
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to