예제 #1
0
 @TestTargetNew(
     level = TestLevel.COMPLETE,
     notes = "Test {@link ImageView#setMaxWidth(int)}",
     method = "setMaxWidth",
     args = {int.class}
 )
 @ToBeFixed(bug="1400249", explanation="It will be tested by functional test.")
 public void testSetMaxWidth() {
     ImageView imageView = new ImageView(mActivity);
     imageView.setMaxWidth(120);
     imageView.setMaxWidth(-1);
 }
 @Override
 protected ImageView getImageView(Context context, List<String> imageURLs) {
   ImageView imgView = new ImageView(context);
   imgView.setMaxHeight(ViewGroup.LayoutParams.MATCH_PARENT);
   imgView.setMaxWidth(ViewGroup.LayoutParams.MATCH_PARENT);
   return imgView;
 }
예제 #3
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.comment);

    final EditText edt = (EditText) findViewById(R.id.editText1);
    TextView t = (TextView) findViewById(R.id.textView1);
    Button b = (Button) findViewById(R.id.button1);
    Bundle extra = getIntent().getExtras();

    t.setText((extra.getString("user") + ":\n" + extra.getString("update")));
    ImageView iv = (ImageView) findViewById(R.id.imageView1);
    final Main imageGetter = new Main();
    Bitmap bmp = imageGetter.getImageFromWeb(imageGetter.webRoot + extra.getString("pic"));
    iv.setImageBitmap(bmp);
    iv.setAdjustViewBounds(true);
    iv.setMaxHeight(120);
    iv.setMaxWidth(120);

    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Toast.makeText(getApplicationContext(), edt.getText(), Toast.LENGTH_LONG).show();
          }
        });
  }
예제 #4
0
  @Override
  public View getView(final int position, View view, ViewGroup arg2) {
    ViewHolder viewHolder = null;
    final ContactSortModel item = (ContactSortModel) getItem(position);
    if (view == null) {
      viewHolder = new ViewHolder();
      view = LayoutInflater.from(mContext).inflate(R.layout.contact_item, null);
      viewHolder.tvTitle = (TextView) view.findViewById(R.id.title);
      viewHolder.tvLetter = (TextView) view.findViewById(R.id.catalog);
      view.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) view.getTag();
    }

    // 根据position获取分类的首字母的Char ascii值
    int section = getSectionForPosition(position);

    // 如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现
    if ("添加好友".equals(item.getRoster().getAlias()) || "新朋友".equals(item.getRoster().getAlias())) {
      viewHolder.tvLetter.setVisibility(View.GONE);
    } else if (position == getPositionForSection(section)) {
      viewHolder.tvLetter.setVisibility(View.VISIBLE);
      viewHolder.tvLetter.setText(item.getSortLetters());

    } else {
      viewHolder.tvLetter.setVisibility(View.GONE);
    }

    viewHolder.tvTitle.setText(item.getRoster().getAlias());

    ImageView image = (ImageView) view.findViewById(R.id.iv_icon); // 获得ImageView对象
    viewHolder.tvImage = image;
    if ("添加好友".equals(item.getRoster().getAlias())) {
      viewHolder.tvImage.setBackgroundResource(R.drawable.contact_add_friends);
    } else if ("新朋友".equals(item.getRoster().getAlias())) {
      viewHolder.tvImage.setBackgroundResource(R.drawable.contact_new_friends);
    } else {
      viewHolder.tvImage.setBackgroundResource(R.drawable.default_mobile_avatar);

      File file = new File("mnt/sdcard/Wanglai/Avatar/" + item.getRoster().getJid() + ".png");
      if (file.exists()) {
        Bitmap bitmap =
            getLoacalBitmap(
                "mnt/sdcard/Wanglai/Avatar/" + item.getRoster().getJid() + ".png"); // 从本地取图片vcard
        // 设置Bitmap
        image.setImageBitmap(bitmap);
        // 设置Imageview
        image.setAdjustViewBounds(true);
        image.setMaxHeight(60);
        image.setMaxWidth(60);
        viewHolder.tvImage = image;
        viewHolder.tvImage.setBackgroundResource(0);
      }
    }

    return view;
  }
예제 #5
0
 public void run() {
   titleIcon.setAdjustViewBounds(true);
   titleIcon.setMaxHeight(viewSize);
   titleIcon.setMaxWidth(viewSize);
   titleIcon.setMinimumHeight(viewSize);
   titleIcon.setMinimumWidth(viewSize);
   titleIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
   titleIcon.setImageBitmap(bitmap);
   menuIconAnimation(titleIcon);
 }
  /** Lancement d'un rechargement du flux */
  private void launchReload(GeekIncRssListActivity activity) {
    instantiateAndShowProgressDialog(activity, 0);

    ImageView img = (ImageView) activity.findViewById(R.id.geekIncHDLogo);
    img.setAdjustViewBounds(true);
    int width = (int) (activity.getResources().getDisplayMetrics().density * 100 + 0.5f);
    img.setMaxWidth(width);

    ProgressTask task = new ProgressTask(activity, width);
    task.execute();
    listData.setTask(task);
  }
 @Override
 public void onHandleScreenshot(Bitmap screenshot) {
   if (screenshot != null) {
     mScreenshot.setImageBitmap(screenshot);
     mScreenshot.setAdjustViewBounds(true);
     mScreenshot.setMaxWidth(screenshot.getWidth() / 3);
     mScreenshot.setMaxHeight(screenshot.getHeight() / 3);
     mFullScreenshot.setImageBitmap(screenshot);
   } else {
     mScreenshot.setImageDrawable(null);
     mFullScreenshot.setImageDrawable(null);
   }
 }
예제 #8
0
 public void applyFromAppWidgetProviderInfo(
     AppWidgetProviderInfo info, int maxWidth, int[] cellSpan) {
   mIsAppWidget = true;
   final ImageView image = (ImageView) findViewById(R.id.widget_preview);
   if (maxWidth > -1) {
     image.setMaxWidth(maxWidth);
   }
   image.setContentDescription(info.label);
   final TextView name = (TextView) findViewById(R.id.widget_name);
   name.setText(info.label);
   final TextView dims = (TextView) findViewById(R.id.widget_dims);
   if (dims != null) {
     int hSpan = Math.min(cellSpan[0], LauncherModel.getCellCountX());
     int vSpan = Math.min(cellSpan[1], LauncherModel.getCellCountY());
     dims.setText(String.format(mDimensionsFormatString, hSpan, vSpan));
   }
 }
  public ImageView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    initImageView();

    TypedArray a =
        context.obtainStyledAttributes(
            attrs, com.android.internal.R.styleable.ImageView, defStyle, 0);

    Drawable d = a.getDrawable(com.android.internal.R.styleable.ImageView_src);
    if (d != null) {
      setImageDrawable(d);
    }

    mBaselineAligned =
        a.getBoolean(com.android.internal.R.styleable.ImageView_baselineAlignBottom, false);

    setAdjustViewBounds(
        a.getBoolean(com.android.internal.R.styleable.ImageView_adjustViewBounds, false));

    setMaxWidth(
        a.getDimensionPixelSize(
            com.android.internal.R.styleable.ImageView_maxWidth, Integer.MAX_VALUE));

    setMaxHeight(
        a.getDimensionPixelSize(
            com.android.internal.R.styleable.ImageView_maxHeight, Integer.MAX_VALUE));

    int index = a.getInt(com.android.internal.R.styleable.ImageView_scaleType, -1);
    if (index >= 0) {
      setScaleType(sScaleTypeArray[index]);
    }

    int tint = a.getInt(com.android.internal.R.styleable.ImageView_tint, 0);
    if (tint != 0) {
      setColorFilter(tint, PorterDuff.Mode.SRC_ATOP);
    }

    mCropToPadding = a.getBoolean(com.android.internal.R.styleable.ImageView_cropToPadding, false);

    a.recycle();

    // need inflate syntax/reader for matrix
  }
    // ---returns an ImageView view---
    public View getView(int position, View convertView, ViewGroup parent) {
      ImageView imageView;
      if (convertView == null) {
        imageView = new ImageView(context);
        imageView.setLayoutParams(new GridView.LayoutParams(185, 185));
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(5, 5, 5, 5);
        Point size = new Point();
        ProfilePageChooseProfileImageActivity.this
            .getWindowManager()
            .getDefaultDisplay()
            .getSize(size);

        int imageMaxSize = size.y / 13;

        imageView.setMaxHeight(imageMaxSize);
        imageView.setMaxWidth(imageMaxSize);

      } else {
        imageView = (ImageView) convertView;
      }
      imageView.setImageResource(imageIDs[position]);
      return imageView;
    }
예제 #11
0
파일: BottomBar.java 프로젝트: najasum/Help
  public BottomBar(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.BottomBar);
    image1 = ta.getDrawable(R.styleable.BottomBar_ImageView1);
    image2 = ta.getDrawable(R.styleable.BottomBar_ImageView2);
    image3 = ta.getDrawable(R.styleable.BottomBar_ImageView3);
    image4 = ta.getDrawable(R.styleable.BottomBar_ImageView4);
    image1Height = ta.getDimension(R.styleable.BottomBar_ImageView1Height, 50);
    image2Height = ta.getDimension(R.styleable.BottomBar_ImageView2Height, 0);
    image3Height = ta.getDimension(R.styleable.BottomBar_ImageView3Height, 0);
    image4Height = ta.getDimension(R.styleable.BottomBar_ImageView4Height, 0);

    image1Width = ta.getDimension(R.styleable.BottomBar_ImageView1Width, 50);
    image2Width = ta.getDimension(R.styleable.BottomBar_ImageView2Width, 0);
    image3Width = ta.getDimension(R.styleable.BottomBar_ImageView3Width, 0);
    image4Width = ta.getDimension(R.styleable.BottomBar_ImageView4Width, 0);

    ta.recycle();

    imageView1 = new ImageView(context);
    imageView2 = new ImageView(context);
    imageView3 = new ImageView(context);
    imageView4 = new ImageView(context);

    imageView1.setImageDrawable(image1);
    imageView1.setAdjustViewBounds(true);
    imageView1.setMaxHeight((int) image1Height);
    imageView1.setMaxWidth((int) image1Width);

    imageView2.setImageDrawable(image2);
    imageView2.setAdjustViewBounds(true);
    imageView2.setMaxHeight((int) image2Height);
    imageView2.setMaxWidth((int) image2Width);

    imageView3.setImageDrawable(image3);
    imageView3.setAdjustViewBounds(true);
    imageView3.setMaxHeight((int) image3Height);
    imageView3.setMaxWidth((int) image3Width);

    imageView4.setImageDrawable(image4);
    imageView4.setAdjustViewBounds(true);
    imageView4.setMaxHeight((int) image4Height);
    imageView4.setMaxWidth((int) image4Width);

    setOrientation(LinearLayout.HORIZONTAL);
    setBackgroundColor(0x8800CCCC);

    param1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param1.gravity = Gravity.CENTER_VERTICAL;
    param1.weight = 1;
    addView(imageView1, param1);

    param2 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param2.gravity = Gravity.CENTER_VERTICAL;
    param2.weight = 1;
    addView(imageView2, param2);

    param3 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param3.gravity = Gravity.CENTER_VERTICAL;
    param3.weight = 1;
    addView(imageView3, param3);

    param4 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param4.gravity = Gravity.CENTER_VERTICAL;
    param4.weight = 1;
    addView(imageView4, param4);

    imageView1.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            listener.Click1();
          }
        });
    imageView2.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            listener.Click2();
          }
        });
    imageView3.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            listener.Click3();
          }
        });
    imageView4.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            listener.Click4();
          }
        });
  }
예제 #12
0
  @SuppressLint("NewApi")
  public void onActivityResult(int requestCode, int resultCode, Intent data) {

    selectedVideos = new ArrayList<String>();

    if (resultCode == RESULT_OK && requestCode == VIDEO_RESULT) {
      try {

        uriVideo = data.getData();
        /*Toast.makeText(createvideo.this, uriVideo.getPath(),
        Toast.LENGTH_LONG).show();*/

        selectedImagePath = uriVideo.getPath();
        // selectedImages = new ArrayList<String>();

        byte[] ba = getCapturedVideoStream(editvideo.this, data);
        MyWrite(ba);

        // selectedImagePath = Base64.encodeBytes(ba);
        selectedVideos.add(selectedImagePath);
        /*Toast.makeText(createvideo.this, selectedImagePath,
        Toast.LENGTH_LONG).show();*/

        Bitmap thumb =
            ThumbnailUtils.createVideoThumbnail(
                selectedImagePath, MediaStore.Images.Thumbnails.MICRO_KIND);
        /*
         * Drawable d = new BitmapDrawable(getResources(),thumb);
         * //video_intro.setBackgroundDrawable(d); //int height =
         * img_videointro.getHeight(); //int width =
         * img_videointro.getWidth();
         * img_videointro.setImageBitmap(thumb); d =
         * getResources().getDrawable(R.drawable.videowith);
         * img_videointro.setBackgroundDrawable(d);
         * img_videointro.setPadding(0,10,0,0);
         */
        // img_videointro.getLayoutParams().height = height;
        // img_videointro.getLayoutParams().width = width;
        // LinearLayout.LayoutParams layoutParams = new
        // LinearLayout.LayoutParams(video_intro.getWidth()-10,
        // video_intro.getHeight()-10);
        // video_intro.setLayoutParams(layoutParams);
        // video_intro.setText("");
        int height = img_videointro.getHeight();
        int width = img_videointro.getWidth();
        if (detectVideo.equals("1")) {

          uploadVideo(c.link.toString() + "/video1.php", "video1");
          Drawable d = new BitmapDrawable(getResources(), thumb);
          img_videointro.setImageBitmap(thumb);
          d = getResources().getDrawable(R.drawable.videowith);
          img_videointro.setBackgroundDrawable(d);
          img_videointro.setPadding(0, 10, 0, 0);
          img_videointro.setMaxHeight(height);
          img_videointro.setMaxWidth(width);
        } else if (detectVideo.equals("2")) {
          uploadVideo(c.link.toString() + "/video2.php", "video2");
          Drawable d = new BitmapDrawable(getResources(), thumb);
          img_videopet.setImageBitmap(thumb);
          d = getResources().getDrawable(R.drawable.videowith);
          img_videopet.setBackgroundDrawable(d);
          img_videopet.setPadding(0, 10, 0, 0);
          img_videopet.setMaxHeight(height);
          img_videopet.setMaxWidth(width);
        } else if (detectVideo.equals("3")) {
          uploadVideo(c.link.toString() + "/video3.php", "video3");
          Drawable d = new BitmapDrawable(getResources(), thumb);
          img_videoplace.setImageBitmap(thumb);
          d = getResources().getDrawable(R.drawable.videowith);
          img_videoplace.setBackgroundDrawable(d);
          img_videoplace.setPadding(0, 10, 0, 0);
          img_videoplace.setMaxHeight(height);
          img_videoplace.setMaxWidth(width);

        } else if (detectVideo.equals("4")) {
          uploadVideo(c.link.toString() + "/video4.php", "video4");
          Drawable d = new BitmapDrawable(getResources(), thumb);
          img_videopick.setImageBitmap(thumb);
          d = getResources().getDrawable(R.drawable.videowith);
          img_videopick.setBackgroundDrawable(d);
          img_videopick.setPadding(0, 10, 0, 0);
          img_videopick.setMaxHeight(height);
          img_videopick.setMaxWidth(width);
        }

      } catch (Exception e) {

      }
    }
  }
    public View getView(int position, View convertView, ViewGroup parent) {
      View slideshowView = convertView;
      if (position >= getCount()) {
        return null;
      }

      SlideshowPhoto slideshowPhoto = getItem(position);
      Log.d(LOG_PREFIX, position + " title:" + slideshowPhoto.getTitle());

      boolean copyDrawableFromCachedView = false;
      View cachedView = null;
      Integer mapKey = new Integer(position);
      if (slideshowView == null) {
        // let's check the weak references for this View
        if (mapWeakRefViews.containsKey(mapKey)) {
          // we have a key, but the View may be garbage collected
          WeakReference<View> weakRefView = mapWeakRefViews.get(mapKey);
          cachedView = weakRefView.get();
          if (cachedView == null) {
            // view was cached, but has been deleted.
            // it will be replaced later in this method, so don't bother deleting it from the
            // hashmap
          } else if (cachedView.getParent() != null) {
            // Log.i(LOG_PREFIX,position + " was cached, but had a parent. So close!");
            copyDrawableFromCachedView = true;
          } else {
            Log.d(LOG_PREFIX, position + " returned through weak reference caching. Yeah!");
            return cachedView;
          }
        }

        // if no cached value, create it from the resource definition
        LayoutInflater viewInflater =
            (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        slideshowView = viewInflater.inflate(R.layout.slideshow_item, null);
      }

      ImageView slideshowImageView = (ImageView) slideshowView.findViewById(R.id.slideshow_photo);
      slideshowImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
      slideshowImageView.setAdjustViewBounds(true);
      // make sure we do not exceed the opengl hardware accl max size
      slideshowImageView.setMaxHeight(2048);
      slideshowImageView.setMaxWidth(2048);

      // The preferred Gallery item background
      slideshowImageView.setBackgroundResource(mGalleryItemBackground);
      slideshowImageView.setBackgroundColor(Color.TRANSPARENT);

      slideshowImageView.setTag(LOADING_TAG);
      slideshowImageView.setImageResource(R.drawable.loading);

      // OLD METHOD
      // These lines of code are in a separate async task in order to not block the UI thread for
      // approx 300 ms
      // Drawable drawable = slideshowPhoto.getLargePhotoDrawable(rootPhotoFolder);
      // slideshowImageView.setImageDrawable(drawable);
      // new ReadPhotoFromFileTask(slideshowImageView,slideshowPhoto,rootPhotoFolder).execute();

      // This section applies if we have a cached view, but it cannot be reuse directly since it has
      // a parent
      // let us copy the drawable
      boolean slideShowImageDrawableMissing = true;
      if (copyDrawableFromCachedView == true && cachedView != null) {
        // reusing the drawable from a cached view
        ImageView cachedSlideshowImageView =
            (ImageView) cachedView.findViewById(R.id.slideshow_photo);
        String cachedTag = (String) cachedSlideshowImageView.getTag();
        if (cachedSlideshowImageView != null && cachedTag != null && cachedTag.equals(LOADED_TAG)) {
          slideshowImageView.setImageDrawable(cachedSlideshowImageView.getDrawable());
          slideShowImageDrawableMissing = false;
          Log.d(LOG_PREFIX, position + " Cached photo drawable reused. Yeah!");
        } else {
          Log.i(
              LOG_PREFIX,
              position + " Cached Photo is not loaded yet, so could not use cache. Doh!");
        }
      }

      if (slideShowImageDrawableMissing) {
        // NEW METHOD
        // Add to a last-in/first-out queue
        AsyncQueueableObject queueablePhotoObject = null;
        queueablePhotoObject =
            new QueueablePhotoObject(
                slideshowPhoto,
                slideshowView,
                rootPhotoFolder,
                LOADED_TAG,
                screenWidthPx,
                screenHeightPx);
        asyncReadQueue.add(queueablePhotoObject);
        Log.d(LOG_PREFIX, position + " is being loaded in a background async task");
      }

      TextView slideshowTitle = (TextView) slideshowView.findViewById(R.id.slideshow_title);
      slideshowTitle.setText(slideshowPhoto.getTitle());

      TextView slideshowDescription =
          (TextView) slideshowView.findViewById(R.id.slideshow_description);
      slideshowDescription.setText(slideshowPhoto.getDescription());
      // add scrolling to TextView
      // slideshowDescription.setMovementMethod(new ScrollingMovementMethod());

      // find out if we should hide the text descriptions
      boolean isEmptyTitle = false;
      if (slideshowPhoto.getTitle() == null || "".equals(slideshowPhoto.getTitle().trim())) {
        isEmptyTitle = true;
      }

      if (doDisplayPhotoTitle == false || slideshowPhoto.isPromotion() || isEmptyTitle) {
        slideshowTitle.setVisibility(View.INVISIBLE);
        slideshowDescription.setVisibility(View.INVISIBLE);
        View layout = slideshowView.findViewById(R.id.slideshow_text_background);
        layout.setVisibility(View.INVISIBLE);
      }

      // lastView = slideshowView;
      // lastFileName=slideshowPhoto.getFileName();

      // add the view to our weak reference caching
      WeakReference<View> weakRefView = new WeakReference<View>(slideshowView);
      mapWeakRefViews.put(mapKey, weakRefView);

      // DEBUG
      String classLayoutParam = null;
      Object objectLayoutParam = slideshowView.getLayoutParams();
      if (objectLayoutParam != null) {
        classLayoutParam = objectLayoutParam.getClass().getName();
      }
      Log.d(LOG_PREFIX, "Layout params class=" + classLayoutParam + " value=" + objectLayoutParam);

      return slideshowView;
    }
예제 #14
0
 public void setMaxWidth(int maxWidth) {
   super.setMaxWidth(maxWidth);
   mMaxWidth = maxWidth;
 }
예제 #15
0
  // set isi tampilan barang di kategori yang sedang dipilih
  private void setContentItemsBarang(JSONArray jsonArray) {
    LinearLayout ll = (LinearLayout) findViewById(R.id.wrapperbarang);
    ll.removeAllViewsInLayout();

    try {
      for (int i = 0; i < jsonArray.length(); i++) {
        final JSONObject jsonObject = jsonArray.getJSONObject(i);

        LinearLayout lytContainer = new LinearLayout(this);
        lytContainer.setOrientation(LinearLayout.VERTICAL);
        if (i % 2 == 1) {
          lytContainer.setBackgroundColor(Color.WHITE);
        } else {
          lytContainer.setBackgroundColor(Color.DKGRAY);
        }

        Drawable image =
            JSON_Response.ImageOperations(this, jsonObject.getString("path_gambar"), "image.jpg");
        ImageView iv = new ImageView(this);
        iv.setAdjustViewBounds(true);
        iv.setMaxHeight(50);
        iv.setMaxWidth(50);
        iv.setImageDrawable(image);
        iv.setPadding(0, 10, 0, 0);
        lytContainer.addView(iv);

        TextView t = new TextView(this);
        t.setText(jsonObject.getString("nama"));
        t.setGravity(Gravity.CENTER);
        t.setTypeface(null, Typeface.BOLD);
        if (i % 2 == 1) {
          t.setTextColor(Color.BLACK);
        } else {
          t.setTextColor(Color.WHITE);
        }
        lytContainer.addView(t);

        TextView t2 = new TextView(this);
        t2.setGravity(Gravity.CENTER);
        t2.setText("Jumlah produk yang tersedia : " + jsonObject.getString("jumlah"));
        if (i % 2 == 1) {
          t2.setTextColor(Color.BLACK);
        } else {
          t2.setTextColor(Color.WHITE);
        }
        t2.setPadding(0, 0, 0, 10);
        lytContainer.addView(t2);

        lytContainer.setOnClickListener(
            new OnClickListener() {

              public void onClick(View arg0) {
                // TODO Auto-generated method stub

                try {
                  System.gc();

                  Intent intent =
                      new Intent(LihatBarangActivity.this, LihatItemBarangActivity.class);
                  intent.putExtra("id", jsonObject.getInt("id"));
                  intent.putExtra("kategori_id", jsonObject.getInt("kategori_id"));
                  intent.putExtra("nama", jsonObject.getString("nama"));
                  intent.putExtra("deskripsi", jsonObject.getString("deskripsi"));
                  intent.putExtra("jumlah", jsonObject.getString("jumlah"));
                  intent.putExtra("harga", jsonObject.getString("harga_satuan"));
                  intent.putExtra("path_gambar", jsonObject.getString("path_gambar"));
                  startActivity(intent);
                } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
              }
            });

        ll.addView(lytContainer);
      }
    } catch (Exception e) {
      Log.d("ancret", e.toString());
      e.printStackTrace();
    }
  }
  private Bitmap getMarkerBitmapFromView(
      View view, ImageView mMarkerImageView, @DrawableRes int resId, String nazwaAlbumu) {

    // View customMarkerView = ((LayoutInflater)
    // context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.element_marker,
    // null);
    // ImageView markerImageView = (ImageView)
    // customMarkerView.findViewById(R.id.miniaturka_marker);

    if (nazwaAlbumu != "") {
      Bitmap bitmap = dekodowanieBitmapy(sciezkaDoZdjecia, 40, 40);
      // Bitmap bitmap = BitmapFactory.decodeFile(sciezkaDoZdjecia);
      //
      try {
        ExifInterface exif = new ExifInterface(sciezkaDoZdjecia);
        int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
        Matrix matrix = new Matrix();
        if (orientation == 6) {
          matrix.postRotate(90);
        } else if (orientation == 3) {
          matrix.postRotate(180);
        } else if (orientation == 8) {
          matrix.postRotate(270);
        }
        // Bitmap bitmap = BitmapFactory.decodeFile(sciezka[obecneZdjecie]);
        bitmap =
            Bitmap.createBitmap(
                bitmap,
                0,
                0,
                bitmap.getWidth(),
                bitmap.getHeight(),
                matrix,
                true); // rotating bitmap

        mMarkerImageView.setImageBitmap(bitmap);
        mMarkerImageView.setMaxWidth(60);
        mMarkerImageView.setMaxHeight(60);
        mMarkerImageView.setMinimumWidth(57);
        mMarkerImageView.setMinimumHeight(57);
        //    markerImageView.setImageBitmap(bitmap);
        //   Toast.makeText(context, "bitmapa wgrana", Toast.LENGTH_SHORT).show();
      } catch (Exception e) {
      }
    }

    // markerImageView.setImageResource(R.drawable.folder_multiple_image);
    // markerImageView.setImageResource(context.getResources().getIdentifier("folder_multiple_image", "drawable", context.getPackageName()));
    // markerImageView.setImageResource(context.getResources().getIdentifier("folder_multiple_image", "drawable", context.getPackageName()));

    view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
    view.buildDrawingCache();
    Bitmap returnedBitmap =
        Bitmap.createBitmap(
            view.getMeasuredWidth(), view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(returnedBitmap);
    canvas.drawColor(Color.WHITE, PorterDuff.Mode.SRC_IN);
    Drawable drawable = view.getBackground();
    if (drawable != null) drawable.draw(canvas);
    view.draw(canvas);
    return returnedBitmap;
  }