I am trying to create an application which dynamically lists installed applications in a gridview.I am able to display the applications in a gridview form but not able to make these application icons clickable. Nothing happens when i click these icons. The code inside the setOnItemClickListener does not get triggered on click event.
Part of code :
Class name dynamicgridactivity.java
mGridMain.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
ViewHolder holder = (ViewHolder)v.getTag();
Log.i("view get tag" ,v.getTag().toString());
if(holder == null) {
return; }
Toast.makeText(dynamicgridactivity.this, "Hello", Toast.LENGTH_SHORT).show();
} });
}
Note: My application icons and text in gridview display are dynamic and not static as given in android examples.
Can Someone suggest me a sure working way of making grid items clickable.