android - LongClick not working on an empty gridview -


is possible handle longclick on empty gridview or on empty place of gridview? tried use code shown below:

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     gridview gridview = (gridview) findviewbyid(r.id.gridview1);      gridview.setonlongclicklistener(new onlongclicklistener() {          @override         public boolean onlongclick(view v) {             toast.maketext(mainactivity.this, "does works?", toast.length_short).show();             return false;         }     }); } 

but, unfortunately, doesn't work. tell me, how can handle event on empty gridview? thanks

i attach xml file:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="-5dip" android:orientation="vertical" > <gridview         android:id="@+id/gridview1"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:clickable="true"         android:longclickable="true"         android:layout_weight="1"         android:numcolumns="3" >     </gridview> 

gridview consists of views created adapter. if want add longclicklistener should use onitemlongclicklistener. don't think there's usefulness of using longclicklistener in gridview itself.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -