how to load an image from url in native (cpp) and load it in android -


i looking on research based on loading image in native cpp side , calling function in java class display image in android app.

  • currently adding image passing string (url) cpp side.
  • loading image part done in java class itself

    private class downloadimagefrominternet extends asynctask<string, void, bitmap> { imageview imageview;  public downloadimagefrominternet(imageview imageview) {     this.imageview = imageview;     toast.maketext(getapplicationcontext(), "please wait...", toast.length_short).show(); }  protected bitmap doinbackground(string... urls) {     string imageurl = urls[0];     bitmap bimage = null;     try {         inputstream in = new java.net.url(imageurl).openstream();         bimage = bitmapfactory.decodestream(in);      } catch (exception e) {         log.e("error message", e.getmessage());         e.printstacktrace();     }     return bimage; }  protected void onpostexecute(bitmap result) {     imageview.setimagebitmap(result); }   } 

this sample code loads image in android side


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -