Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GetItemThumb extends AsyncTask<String, Void,Bitmap> {
- private final WeakReference<ImageView> imageViewReference = null;
- private int data = 0;
- protected void onPostExecute(Bitmap result) {
- itemImage.setImageBitmap(thumbImg);
- JSONObject resultObject = null;
- try{
- //BarCodeActivity.titleText.setText("TITLE: "+resultObject.getString("itemname"));
- System.out.println(resultObject.getString("pictures"));
- itemImage .setImageBitmap(result);
- }
- catch(Exception e){
- e.getStackTrace();
- }
- }
- @Override
- protected Bitmap doInBackground(String... thumbURLs) {
- System.out.println("getting image");
- BufferedInputStream thumbBuff = null;
- Bitmap pic = null;
- try{
- URL thumbURL = new URL(thumbURLs[0]);
- URLConnection thumbConn = thumbURL.openConnection();
- thumbConn.connect();
- InputStream thumbIn = thumbConn.getInputStream();
- thumbBuff = new BufferedInputStream(thumbIn);
- pic = BitmapFactory.decodeStream(thumbBuff);
- thumbBuff.close();
- thumbIn.close();
- }
- catch(Exception e) {
- e.printStackTrace();
- };
- return pic;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment