Hi,
I have a gridview that successfully registers and responds to an
OnItemLongClickListener, no problem. What I'm trying to add is an
OnLongClickListener to respond to a user selecting empty space on a
gridview; so that I pop up my 'add widget' view (In contrast to the
Item listener that brings up an Edit view). I already have this in a
menu as well but, it seems like pretty common behavior in other apps
to respond to a long click in this empty space.
The problem is that I can't seem to get the OnLongClick() to fire.
Searching forums I see similar complaints about MapView. Is
OnLongClick disabled for views that use OnItemLongClick?
GridView gridview = (GridView) findViewById(R.id.mygridview);
gridview.setAdapter(gridadapter);
// -- OnItemClickListener here, removed for simplicity
// Problem Code Below
OnLongClickListener myLongListener = new OnLongClickListener()
{
@Override
public boolean onLongClick(View v) {
Toast.makeText(MainView.this, "I am alive!",
Toast.LENGTH_SHORT).show();
return true;
}
};
gridview.setLongClickable(true);
gridview.setOnLongClickListener(myLongListener );
--
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