Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - How to sync my app with photos

How to sync my app with photos

All your problems with Audio, Video and Images.

How to sync my app with photos

Postby gerbit » Tue Feb 08, 2011 11:23 pm

Ok. Sorry if this queshion be here.

I build custom gallery for photos only. I taking photos from sdcard with this class:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Photos {
  2.         public static final String PHOTO_BUCKET_NAME =
  3.                 Environment.getExternalStorageState().toString() + "/DCIM/Camera";
  4.         public static final int PHOTO_BUCKET_ID = getBucketId(PHOTO_BUCKET_NAME);
  5.  
  6.         public static int getBucketId(String path) {
  7.                 return path.toLowerCase().hashCode();
  8.         }
  9.        
  10.         public static List<String> getPhotos(Context context) {
  11.                 final String[] projection = {MediaStore.Images.Media.DATA};
  12.                 final String selection = MediaStore.Images.Media.BUCKET_ID;
  13.                 Cursor c = context.getContentResolver().query(Images.Media.EXTERNAL_CONTENT_URI, projection, selection, null, null);
  14.                 List<String> result = new ArrayList<String>(c.getCount());
  15.                 if (c.moveToFirst()) {
  16.                         int dataColumn = c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
  17.                         do {
  18.                                 String data = c.getString(dataColumn);
  19.                                 result.add(data);
  20.                         } while (c.moveToNext());
  21.                 }
  22.                 c.close();
  23.                 return result;
  24.         }
Parsed in 0.015 seconds, using GeSHi 1.0.8.4

And set adapter to gallery:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ImageAdapter extends BaseAdapter {
  2.             int GalItemBg;
  3.             private Context mContext;
  4.             private List<String> photoList;
  5.  
  6.             public ImageAdapter(Context c) {
  7.                 mContext = c;
  8.                 photoList = Photos.getPhotosThumbnails(c);
  9.                 TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme);
  10.             GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0);
  11.             typArray.recycle();
  12.             }
  13.  
  14.             @Override
  15.                 public int getCount() {
  16.                 return photoList.size();
  17.             }
  18.  
  19.             @Override
  20.                 public Object getItem(int position) {
  21.                 return position;
  22.             }
  23.  
  24.             @Override
  25.                 public long getItemId(int position) {
  26.                 return position;
  27.             }
  28.  
  29.             @Override
  30.                 public View getView(int position, View convertView, ViewGroup parent) {
  31.                 ImageView i = new ImageView(mContext);
  32.  
  33.                 Bitmap bm = BitmapFactory.decodeFile(photoList.get(position));
  34.                 i.setImageBitmap(bm);
  35.                 i.setLayoutParams(new Gallery.LayoutParams(80,70));
  36.                 i.setScaleType(ImageView.ScaleType.FIT_XY);
  37.                 i.setBackgroundResource(GalItemBg);
  38.            
  39.                 return i;
  40.             }
  41.         }
  42. }
Parsed in 0.011 seconds, using GeSHi 1.0.8.4

There is nothing special. When i run my app, all good it works. After that I launch camera and taking some photos, in this time my app running in background. When I back to my app, I need to see new photos. How to do it?

Thank you
gerbit
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Feb 08, 2011 8:48 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 4 guests