You can use the setTag() adnd getTag() which allow you to put/get any type of object.
So in the future, you will be able to pass anything (if you make the appropriate cast after)
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.cell, null);
}
Button button = (Button) convertView.findViewById(R.id.grid_item);
button.setText(items[position]);
convertView.setTag(items[position]);
return convertView;
}
AND
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
String str = (String) view.getTag();
text.setText(str);
Log.i("ITEM_CLICKED", "" + (String) (gridView.getItemAtPosition(position)));
}
});