Android: Click on ListView item -> Popup box with ImageView in it from url -


i have implemented listview , onitemclicklistener on click returns me url of image in listview.

its' happening in fragment, how can create fragment or box on top of listview , load image in url?

here onitemclicklistener:

chat.setonitemclicklistener(new adapterview.onitemclicklistener() {     @override     public void onitemclick(adapterview<?> parent, view view, int position, long id) {          object itm = parent.getitematposition(position);         list<string> imagelink = extracturls(string.valueof(itm));         string displaylink = "no image";         if(imagelink.size() != 0){             displaylink = imagelink.get(0);             //display image in popup.         }       } }); 

this solution quite dirty requires 5 lines of code.
uses webview inside alertdialog download , display image.

string displaylink = "https://cdn.sstatic.net/stackoverflow/img/apple-touch-icon@2.png";  alertdialog.builder d = new alertdialog.builder(this); webview w = new webview(this); w.setlayoutparams(new layoutparams(layoutparams.match_parent,layoutparams.match_parent)); w.loaddata("<img style=\"width:100%\" src=\""+displaylink+"\" />", "text/html", "utf-8"); d.setview(w).show(); 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -