0

hi I am trying to load an image from an url using novoda Direct ImageLoader method right now I have this class

public class MainActivity extends Activity {
public class DirectLoading extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ImageView iv=(ImageView) findViewById(R.id.imageView1);
        ImageView ivv=(ImageView) findViewById(R.id.imageView2);

        Bitmap b=new DirectLoader()
                .download("https://upload.wikimedia.org/wikipedia/commons/a/ad/SmallStellatedDodecahedron.jpg");
        Bitmap pic=new DirectLoader()
                .download("http://www.coetail.com/mamitakagi1129/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg");

        ivv.setImageBitmap(pic);
        iv.setImageBitmap(b);

    }

    private void guiBuilder() {

    }
}
}

I should get 2 images into the 2 imageViews, but I am getting a blank screen. There is a "Hello world" string in the layout that is not displayed so I guess I do get the images but they are not displayed graphically.

Alex Styl
  • 3,982
  • 2
  • 28
  • 47

1 Answers1

0

As it says in readme file https://github.com/novoda/ImageLoader/blob/develop/README.md you should handle threading when using DirectLoader.download(), for example, using AsyncTask.

Glauco Neves
  • 3,483
  • 1
  • 24
  • 36