use of com.daimajia.swipedemo.adapter.GridViewAdapter in project AndroidSwipeLayout by daimajia.
the class GridViewExample method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gridview);
final GridView gridView = (GridView) findViewById(R.id.gridview);
final GridViewAdapter adapter = new GridViewAdapter(this);
adapter.setMode(Attributes.Mode.Multiple);
gridView.setAdapter(adapter);
gridView.setSelected(false);
gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Log.e("onItemLongClick", "onItemLongClick:" + position);
return false;
}
});
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.e("onItemClick", "onItemClick:" + position);
}
});
gridView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.e("onItemSelected", "onItemSelected:" + position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
Aggregations