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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -