Reputation: 199
I'm attempting to obtain an image URL through JSON data, which works successfully. Everything below works SLOWLY. However, I am trying to figure out a way to get a URL to display much faster below in Android Volley or another fast method. I am trying to download these images from a URL (resized too) into a MapView
pin icon. If there is a more efficient example anyone can find, I am all in. Please let me know if you need more information from me. I am following this guide: Android load from URL to Bitmap
final String profilePicture = profilePic;
URL url = new URL(profilePicture);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
Bitmap bit = BitmapFactory.decodeStream(is);
Bitmap b = Bitmap.createScaledBitmap(bit, 100, 100, false);
ByteArrayOutputStream out = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.JPEG, 10, out);
Bitmap decoded = BitmapFactory.decodeStream(new ByteArrayInputStream(out.toByteArray()));
bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(decoded);
Upvotes: 0
Views: 148
Reputation: 567
You can use Koushik Ion library. Its very easy to use.
[https://github.com/koush/ion][1]
Upvotes: 0
Reputation: 1528
Use picasso library :
http://square.github.io/picasso/
Its easy to use and have alot of useful feature !
For example :
Picasso.with(context)
.load(url)
.resize(50, 50)
.centerCrop()
.into(imageView)
Upvotes: 1