etrademom
etrademom

Reputation: 221

load image into imageView from URL path in DB Table

I'm trying to follow this this tutorial to add image into imageView from URL.

public class AndroidLoadImageFromURLActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);            

        ImageView image = (ImageView) findViewById(R.id.image);

        String image_url = "http://api.androidhive.info/images/sample.jpg";

        ImageLoader imgLoader = new ImageLoader(getApplicationContext());


        imgLoader.DisplayImage(image_url, image);
    }
}

However, I have the image urls stored in my database table and would like to grab and display dynamically in java. please kindly show me how to do this in java? Thank you so much!

Upvotes: 1

Views: 422

Answers (1)

G_S
G_S

Reputation: 7110

try this link

here there is a function named showImage() which accepts a url as parameter and returns bitmap which you can use to set to the image view.

and dont forget to give the internet permission when dealing with images to be displayed from a url

Upvotes: 1

Related Questions