Android - Having photo selection for more than one "PhotoView"? -
i created more 1 "photoview". created variables wanted use following code:
public void sayfaekle(int id) throws jsonexception { layoutinflater inflater = this.getlayoutinflater(); framelayout f; int photos = 0; switch (id){ case 1: photos = 5; final drawable bitmap = contextcompat.getdrawable(this,r.drawable.complex); f = (framelayout) inflater.inflate (r.layout.foto_layout_1, null); int pageid = addview(f); sayfa_sablon_ids.put("sayfa_"+pageid, id); map<string, photoview> fotograflar = new hashmap<string, photoview>(); for( int z = 1; z<= photos; z++ ) { int idresource = getresources().getidentifier("photo_" + z + "_area", "id", getpackagename()); final photoview photoview = (photoview) f.findviewbyid(idresource); photoview.setscaletype(imageview.scaletype.center_crop); photoview.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { photoview.setimagedrawable(bitmap); log.d("onclick"," yes "); } }); fotograflar.put("pview"+z,photoview); } sayfalar.put("sayfa_"+pageid,fotograflar); break; case 2: f = (framelayout) inflater.inflate (r.layout.foto_layout_2, null); log.d("id", "iki --------------------"); break; default: f = (framelayout) inflater.inflate (r.layout.foto_layout_1, null); } }
but in code choose photo. want photo selected user clicking on "photoview".
how can it?
try
//make bitmap object final final bitmap bitmap = //replace getbitamp(); int photos = 5; map<string, photoview> ppp = new hashmap<string, photoview>(); for( int z = 1; z<= photos; z++ ) { int idresource = getresources() .getidentifier("photo_"+z+"_area", "id", getpackagename()); photoview photoview = (photoview) f.findviewbyid(idresource); photoview.setimagedrawable(bitmap); photoview.setscaletype(imageview.scaletype.center_crop); photoview.setonclicklistener(new onclicklistener() { public void onclick(view v) { photoview.setimagebitmap(bitmap); //select.... } }); ppp.put("pview"+z,photoview);
Comments
Post a Comment