android - CheckBox unhide on GridView -


i did set checkbox visibility "gone" , in xml file , , want unhide when go onitemlonglistnere , on gridview , other words , if have 8 pics in gridview , want unhide checkbox each photo! thanks

my gridviewadapter

 public class gridviewadapter extends baseadapter { // declare variables imageview image; private activity activity; private string[] filepath; private string[] filename;  private static layoutinflater inflater = null;  public gridviewadapter(activity a, string[] fpath, string[] fname) {     activity = a;     filepath = fpath;     filename = fname;     inflater = (layoutinflater) activity             .getsystemservice(context.layout_inflater_service);  }   public int getcount() {     return filepath.length;  }  public object getitem(int position) {     return position; }  public long getitemid(int position) {     return position; }   public view getview(int position, view convertview, viewgroup parent) {     view vi = convertview;     if (convertview == null)         vi = inflater.inflate(r.layout.gridview_item, null);     // locate textview in gridview_item.xml     textview text = (textview) vi.findviewbyid(r.id.text);     // locate imageview in gridview_item.xml      image = (imageview) vi.findviewbyid(r.id.grid_image);      // set file name textview followed position     file file = new file(filepath[position]);     picasso.with(activity).load(file).placeholder(r.drawable.rtrt).fit().centercrop().into(image);       // decode filepath bitmapfactory followed position       // set decoded bitmap imageview   //  image.setimagebitmap(bmp);     return vi; } 

}

maybe can you.

public class gridviewadapter extends baseadapter {         // declare variables          private activity activity;         private string[] filepath;         private string[] filename;          private static layoutinflater inflater = null;          public gridviewadapter(activity a, string[] fpath, string[] fname) {             activity = a;             filepath = fpath;             filename = fname;             inflater = (layoutinflater) activity.getsystemservice(context.layout_inflater_service);         }          public int getcount() {             return filepath.length;         }          public object getitem(int position) {             return position;         }          public long getitemid(int position) {             return position;         }          public view getview(int position, view convertview, viewgroup parent) {             final holder holder;              if (convertview == null) {                 holder = new holder();                 convertview = inflater.inflate(r.layout.gridview_item, null);                 holder.image = (imageview) convertview.findviewbyid(r.id.grid_image);                 holder.text = (textview) convertview.findviewbyid(r.id.text);                 holder.ck = (checkbox) convertview.findviewbyid(r.id.checkbox);                 convertview.settag(holder);             } else {                 holder = (holder) convertview.gettag();             }              // set file name textview followed position             file file = new file(filepath[position]);             holder.ck.setvisibility(view.gone);             picasso.with(activity).load(file).placeholder(r.drawable.rtrt).fit().centercrop().into(holder.image);             return convertview;         }          class holder {             imageview image;             textview text;             checkbox ck;         }     } 

and on gridview longclick

gridview.setonitemlongclicklistener(new onitemlongclicklistener() {      public boolean onitemlongclick(adapterview<?> arg0, view arg1,             int position, long arg3) {         checkbox ck = (checkbox)arg1.findviewbyid(r.id.checkbox);         ck.setvisibility(view.visible);         return true;     } });  

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -