Hi Fina,

I didn't try GestureDetector as I don't want to implement fling
function as default scrolling in GridView already good enough.
I am not sure if with fling function (onScroll) I can transfer
scrolling to default one.

Thanks,
varinag

On Mar 18, 6:15 pm, Fina Perez <[email protected]> wrote:
> Hi!
>
> I haven't seen your code, but have you tried using a GestureDetector?
> (seehttp://developer.android.com/reference/android/view/GestureDetector.O...)
> 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,varinaggold <[email protected]> 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 <[email protected]> wrote:
>
> > > There is a long item click listener in grid view - you do know that, 
> > > right?
> > > 17.03.2011 4:30 пользователь "varinaggold" <[email protected]> 
> > > написал:
>
> > > > 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 <[email protected]> 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,varinaggold <[email protected]
> > > >wrote:
>
> > > >> > Any one?
>
> > > >> > On Mar 15, 4:38 pm,varinaggold <[email protected]> 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
>
> > > [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
>
> > > > --
> > > > 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
>
>

-- 
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