コード例 #1
0
  // create a new ImageView for each item referenced by the Adapter
  public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) { // if it's not recycled, initialize some attributes
      imageView = new ImageView(mActivity);
      imageView.setLayoutParams(new Gallery.LayoutParams(300, 300));
      imageView.setScaleType(ImageView.ScaleType.FIT_XY);

    } else {
      imageView = (ImageView) convertView;
    }

    try {
      // imageView.setImageURI(mUris.get(position));
      imageView.setImageBitmap(
          Utils.decodeFile(10, new File(Utils.getPath(mActivity, mUris.get(position)))));
      imageView.setTag(mUris.get(position).toString());
    } catch (IOException e) {
      Log.e(TAG, "Error in getView()", e);
    }

    return imageView;
  }
コード例 #2
0
 public void addToAdapter(Uri uri) {
   mUris.add(uri);
   this.notifyDataSetChanged();
 }
コード例 #3
0
 public void addAll(Collection<Uri> uris) {
   if (uris != null) {
     mUris.addAll(uris);
   }
 }
コード例 #4
0
 public int getCount() {
   return mUris == null ? 0 : mUris.size();
 }