Bonjour All,

J'apprend a programmer en android et la j'essai de faire du CoverFlow avec des image provenant de ma BD mysql.
J'ai suivi pas mal de tuto et j'ai reussi a le faire avec des image se trouvant dans mon drawable mai je parviens pas a l'adapter pour mes image provenant de ma BD que je stock dans un Arraylist de String.
J'ai besoin d'aide.

CoverFlow.java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
@SuppressWarnings("deprecation")
public class CoverFlow extends Gallery {
 
    private Camera mCamera = new Camera();
    private int mMaxRotationAngle = 60;
    private int mMaxZoom = -120;
    private int mCoveflowCenter;
    public CoverFlow(Context context) {
        super(context);
        this.setStaticTransformationsEnabled(true);
    }
    public CoverFlow(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.setStaticTransformationsEnabled(true);
    }
    public CoverFlow(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        this.setStaticTransformationsEnabled(true);
    }
 
    public int getMaxRotationAngle() {
        return mMaxRotationAngle;
    }
    public void setMaxRotationAngle(int maxRotationAngle) {
        mMaxRotationAngle = maxRotationAngle;
    }
    public int getMaxZoom() {
        return mMaxZoom;
    }
    public void setMaxZoom(int maxZoom) {
        mMaxZoom = maxZoom;
    }
 
    private int getCenterOfCoverflow() {
        return (getWidth() - getPaddingLeft() - getPaddingRight()) / 2 + getPaddingLeft();
    }
    private static int getCenterOfView(View view) {
        return view.getLeft() + view.getWidth() / 2;
    }
 
    protected boolean getChildStaticTransformation(View child, Transformation t) {
        final int childCenter = getCenterOfView(child);
        final int childWidth = child.getWidth() ;
        int rotationAngle = 0;
        t.clear();
        t.setTransformationType(Transformation.TYPE_MATRIX);
        if (childCenter == mCoveflowCenter) {
            transformImageBitmap((ImageView) child, t, 0);
        } else {
            rotationAngle = (int) (((float) (mCoveflowCenter - childCenter)/ childWidth) *  mMaxRotationAngle);
            if (Math.abs(rotationAngle) > mMaxRotationAngle) {
                rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
            }
            transformImageBitmap((ImageView) child, t, rotationAngle);
        }
        return true;
    }
 
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        mCoveflowCenter = getCenterOfCoverflow();
        super.onSizeChanged(w, h, oldw, oldh);
    }
 
    private void transformImageBitmap(ImageView child, Transformation t, int rotationAngle) {
 
        mCamera.save();
        final Matrix imageMatrix = t.getMatrix();;
        final int imageHeight = child.getLayoutParams().height;;
        final int imageWidth = child.getLayoutParams().width;
        final int rotation = Math.abs(rotationAngle);
        mCamera.translate(0.0f, 0.0f, 100.0f);
        if ( rotation < mMaxRotationAngle ) {
            float zoomAmount = (float) (mMaxZoom +  (rotation * 1.5));
            mCamera.translate(0.0f, 0.0f, zoomAmount);
        }
        mCamera.rotateY(rotationAngle);
        mCamera.getMatrix(imageMatrix);
        imageMatrix.preTranslate(-(imageWidth/2), -(imageHeight/2));
        imageMatrix.postTranslate((imageWidth/2), (imageHeight/2));
        mCamera.restore();
    }
}
Galerie.java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
 
public class Galerie extends Fragment {
 
     ArrayList<String> maListDonnee;
     private ImageView viewer;
     String donnee = null;
     private ArrayList<String> mImageIds;
     DownloadImage dmg;
     CoverFlow coverFlow;
     ImageAdapter coverImageAdapter;
 
     @SuppressWarnings("deprecation")
	 @Override
	 public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
 
         View g = inflater.inflate(R.layout.image_frag, container, false);
         coverFlow = new CoverFlow(getActivity());
         coverFlow.setAdapter(new ImageAdapter(getActivity()));
         coverImageAdapter = new ImageAdapter(getActivity());
         coverFlow.setAdapter(coverImageAdapter);
         coverFlow.setSpacing(-25);
         coverFlow.setSelection(4, true);
         coverFlow.setAnimationDuration(1000);
         getActivity().setContentView(coverFlow);
	 return g;
     }
 
     @Override
     public void onStart(){
        super.onStart();
        maListDonnee = new ArrayList<String>();
        mImageIds = new ArrayList<String>();
        Intent i = this.getActivity().getIntent();
        donnee = i.getStringExtra(Accueil.CODE);
        try {
            mImageIds = new DownloadImage().execute().get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }
 
      public class ImageAdapter extends BaseAdapter {
        int mGalleryItemBackground;
        private Context mContext;
        private ImageView[] mImages;
        public ImageAdapter(Context c) {
            mContext = c;
            mImages = new ImageView[mImageIds.size()];
        }
 
        @SuppressWarnings("deprecation")
        public boolean createReflectedImages() {
            final int reflectionGap = 4;
            int index = 0;
            for (int imageId=0;imageId <= mImageIds.size();imageId++) {
                Bitmap originalImage = BitmapFactory.decodeResource(getResources(), imageId);
                int width = originalImage.getWidth();
                int height = originalImage.getHeight();
                Matrix matrix = new Matrix();
                matrix.preScale(1, -1);
                Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height / 2, width, height / 2, matrix, false);
                Bitmap bitmapWithReflection = Bitmap.createBitmap(width,(height + height / 2), Bitmap.Config.ARGB_8888);
                Canvas canvas = new Canvas(bitmapWithReflection);
                canvas.drawBitmap(originalImage, 0, 0, null);
                Paint deafaultPaint = new Paint();
                canvas.drawRect(0, height, width, height + reflectionGap, deafaultPaint);
                canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
                Paint paint = new Paint();
                LinearGradient shader = new LinearGradient(0,
                        originalImage.getHeight(), 0,
                        bitmapWithReflection.getHeight() + reflectionGap,
                        0x70ffffff, 0x00ffffff, Shader.TileMode.CLAMP);
                paint.setShader(shader);
                paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
                canvas.drawRect(0, height, width, bitmapWithReflection.getHeight() + reflectionGap, paint);
                ImageView imageView = new ImageView(mContext);
                imageView.setImageBitmap(bitmapWithReflection);
                android.widget.Gallery.LayoutParams imgLayout = new CoverFlow.LayoutParams(320, 480);
                imageView.setLayoutParams(imgLayout);
                imageView.setPadding(30, 100, 20, 20);
                mImages[index++] = imageView;
            }
            return true;
        }
 
        public int getCount() {
            return mImageIds.size();
        }
 
        public Object getItem(int position) {
            return position;
        }
 
        public long getItemId(int position) {
            return position;
        }
 
        @SuppressWarnings("deprecation")
        public View getView(int position, View convertView, ViewGroup parent) {
            ImageView i = new ImageView(mContext);
            i.setImageResource(mImageIds.get(position));
            i.setLayoutParams(new CoverFlow.LayoutParams(380, 450));
            i.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            BitmapDrawable drawable = (BitmapDrawable) i.getDrawable();
            drawable.setAntiAlias(true);
            return i;
        }
 
        public float getScale(boolean focused, int offset) {
			/* Formula: 1 / (2 ^ offset) */
            return Math.max(0, 1.0f / (float) Math.pow(2, Math.abs(offset)));
        }
    }
}
Voila j'ai comme erreur:
java.lang.NumberFormatException: Invalid int: "http://10.0.2.2/AndroidWork/telephones/S5mini.jpg"
at com.learn2crack.tab.Galerie$ImageAdapter.getView(Galerie.java:194)

Merci d'avance.