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

Martin j 09/05/2017. 0 answers, 34 views
android android android-ndk android-ndk jni

i am looking on a research based on loading an image in native cpp side and calling that function in the java class to display that image in my android app.

  • currently i am adding the image by only passing the string (url) from the cpp side.
  • loading image part is done in the 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;
            bimage = BitmapFactory.decodeStream(in);
        } catch (Exception e) {
            Log.e("Error Message", e.getMessage());
        return bimage;
    protected void onPostExecute(Bitmap result) {

this is my sample code which loads the image in android side

No Answers Yet

Related questions

Hot questions


Popular Tags