Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected Bitmap createBitmap(final int position) {
- Log.v(TAG, "creating item " + position);
- final Bitmap bitmap = getBitmapFromURL(ImgList.get(position)
- .getImageUrl());
- bitmapMap.put(position, new WeakReference<Bitmap>(bitmap));
- return bitmap;
- }
- public static Bitmap getBitmapFromURL(String Url) {
- try {
- URL url = new URL(Url);
- HttpURLConnection connection = (HttpURLConnection) url
- .openConnection();
- connection.setDoInput(true);
- connection.connect();
- InputStream input = connection.getInputStream();
- Bitmap myBitmap = BitmapFactory.decodeStream(input);
- System.out.println("Bitmap Decoded Here size is: "
- + myBitmap.getHeight());
- return myBitmap;
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment