t seems that micro_kind smooth the scrool but all image are in 96*96.
Any solutions please?
On Tuesday, March 13, 2012 11:26:41 AM UTC+1, Carreira david wrote:
>
> It's my first app so i am not use to code on java.
>
> I have a gridview wich display thumbnails from the sdcard, but i can't
> have a smooth scroll.
>
> If I put the /* Treatment part*/ out of the if the scroll is like i want
> but they are duplicate content and a part of the pics are not displayed.
>
> Here is my code:
>
> -Activity:
>
>
> <code>
>
> GridView gridview = (GridView) findViewById(R.id.gridview1);
> String[] projection = {MediaStore.Images.Media._ID};
> String path ="/mnt/sdcard/Pictures";
> // Create the cursor pointing to the SDCard
> cursor = managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
> projection,
> //MediaStore.Images.Media.DATA + " like ? ",
> //new String[] {"%Pictures%Sopi%"},
> "_data LIKE '%" + path + "/%'",
> null,
> MediaStore.Images.Media._ID);
>
> // Get the column index of the Media Image ID
> columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
>
> gridview.setAdapter(new ImageAdapterTest(RoomRawActivity.this));
>
> </code>
>
> -imageAdapater (get view):
>
>
> <code>
>
> public View getView(int position, View convertView, ViewGroup parent) {
>
> Log.v("adapter - getView","getView start!!");
> //Toast.makeText(mContext, "getView start!!"+position, 0).show();
>
> //Move cursor to current position
> RoomRawActivity.cursor.moveToPosition(position);
>
> ImageView picturesView;
>
> if (convertView == null) {
>
> picturesView = new ImageView(mContext);
>
> /* treatment */
>
> // Get the current value for the requested column
> int imageID = RoomRawActivity.cursor.getInt(RoomRawActivity.columnIndex);
> // obtain the image URI
> Uri uri = Uri.withAppendedPath( MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
> Integer.toString(imageID) );
> String url = uri.toString();
>
> //Set the content of the image based on the image URI
> int originalImageId = Integer.parseInt(url.substring(url.lastIndexOf("/") +
> 1, url.length()));
> Bitmap b =
> MediaStore.Images.Thumbnails.getThumbnail(mContext.getContentResolver(),
> originalImageId,
> MediaStore.Images.Thumbnails.MINI_KIND,
> null);
> picturesView.setPadding(5, 5, 5, 5);
> picturesView.setBackgroundResource(R.drawable.border_grid_pics);
>
> picturesView.setImageBitmap(b);
>
> picturesView.setScaleType(ImageView.ScaleType.FIT_XY);
> /* END treatment */
> }
> }else{
> picturesView = (ImageView) convertView;
> }
>
>
>
> return picturesView;
> }
>
> </code>
>
> Many thanks!
>
> David.
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en