How to disable grid item when activity is loaded 
<p>I have few grid items. Depending on the flag, I want to disable some grid items</p>

<p>For example:</p>

<ul>
<li>Grid items are Order,CallLost,Payment. If boolean status = true, then I want to disable <code>CallLost</code>. Others should be enabled.
<ul>
<li>If boolean status = false, then I want to disable <code>Order</code>,<code>Payment</code> &amp; <code>CallLost</code></li>
</ul></li>
</ul>

<p>&amp; I have done grid items using:</p>

<pre><code>     @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.retailer_main);

        Bundle bundle = this.getIntent().getExtras();
        retailerName = bundle.getString("RetailerName");
        relailerCode = bundle.getString("RetailerCode");

        isDefault = bundle.getBoolean("isDefault", false);
        routeCode = bundle.getString("RouteCode");

        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

        SharedPreferences myRoutes = this.getSharedPreferences("myDefalutRoute",MODE_PRIVATE);
        defaultRoutePositions = myRoutes.getInt("defaultRoutePositions", -1);

        retailerGrid = (GridView)findViewById(R.id.retailergridview);
        retailerGrid.setAdapter(new RetailerImageAdapter(this));
        retailerGrid.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position,long id) {
                if (position == 0) {
                    Intent i = new Intent(getBaseContext(), RetailerOrderActivity.class);
                     Bundle bundle = new Bundle();
                     bundle.putString("Activity", "RetailerOptionActivity");
                     bundle.putString("RetailerName", retailerName);
                     bundle.putString("RetailerCode", relailerCode);
                     i.putExtras(bundle);
                    View vi = SalesActivityGroup.group.getLocalActivityManager().startActivity("RetailerOrderActivity", i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
                    SalesActivityGroup.group.replaceView(vi);

                }
                if (position == 2) {
                    Intent i = new Intent(getBaseContext(), CallLostActivity.class);
                     Bundle bundle = new Bundle();
                     bundle.putString("Activity", "RetailerOptionActivity");
                     bundle.putString("RetailerName", retailerName);
                     bundle.putString("RetailerCode", relailerCode);
                     i.putExtras(bundle);
                    View vi = SalesActivityGroup.group.getLocalActivityManager().startActivity("RetailerOrderActivity", i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
                    SalesActivityGroup.group.replaceView(vi);
                }
            }
        });

        Button reOpCancel = (Button)findViewById(R.id.reOpCancel);
        reOpCancel.setOnClickListener(new OnClickListener() {
               public void onClick(View v) {

                    Intent i = new Intent(getBaseContext(), ListRetailerActivity.class);
                    Bundle bundle = new Bundle();
                    bundle.putString("RetailerName", retailerName);
                    bundle.putString("RetailerCode", relailerCode);
                    bundle.putInt("positon", defaultRoutePositions);
                    bundle.putString("RouteCode", routeCode);
                    i.putExtras(bundle);
                    View vi = SalesActivityGroup.group.getLocalActivityManager().startActivity("ListRetailerActivity", i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
                    SalesActivityGroup.group.replaceView(vi);
                    isDefault = false;
                    //defaultRoutePositions = -1;
               }
        });
    }

    public void onCancelAction(View view){
        SalesActivityGroup.group.back();  
        return;
    }

    public void onCompleteAction(View view){
        SalesActivityGroup.group.back();  
        return;
    }

    public class RetailerImageAdapter extends BaseAdapter{
        Context MyContext;

        public RetailerImageAdapter(Context _MyContext){
            MyContext = _MyContext;
        }

        public int getCount() {
            return mThumbIds.length;
        }

        public View getView(int position, View convertView, ViewGroup parent) {
            View v;
            if(convertView==null){
                LayoutInflater li = getLayoutInflater();
                v = li.inflate(R.layout.grid_item, null);
                TextView tv = (TextView)v.findViewById(R.id.grid_item_text);
                tv.setText("Profile "+position);
                ImageView iv = (ImageView)v.findViewById(R.id.grid_item_image);
                tv.setText(names[position]);
                iv.setImageResource(mThumbIds[position]);
            }
            else
            {
                v = convertView;
            }
            return v;
        }

        public Object getItem(int arg0) {
            return null;
        }

//      public boolean  areAllItemsEnabled() {
//          return false;
//      }
//
//
//      public boolean  isEnabled(int position) {
//          if(isDefault){
//              if(position == 0) return true;
//              if(position == 1) return true;
//              if(position == 3) return true;
//              
//          }else{
//              if(position == 2) return false;
//          }
//          return false;
//      }


        public long getItemId(int arg0) {
            return 0;
        }

        // references to our images
        private Integer[] mThumbIds = { 
                R.drawable.one, R.drawable.two,
                R.drawable.five, R.drawable.four, 
                R.drawable.eight,R.drawable.seven,
                R.drawable.seven,R.drawable.seven,
                R.drawable.seven
            };
        private String[] names = {
                "Order","Order Flow",
                "Call Lost","Collection",
                "Cancel Invoice","Survey",
                "Complain","Customer Card",
                "ComInv"
        };
    }
}
</code></pre>

<p>Please any idea regarding this. I have seen <a href="http://stackoverflow.com/questions/5514629/how-to-disable-item-click-for-particular-positions-in-grid-view-in-android">this</a> but it disables all items, just specific ones.</p>
