2011-12-02 9 views
1

내 갤러리에 대해 여러 이미지를 설정 한 후에는 사용 된 모든 리소스 ID를 가져 오려고합니다. Gallery 내 ImageView의 Image Resources (int)를 얻으려면 어떻게해야합니까?ImageView의 이미지 리소스

감사합니다.

+0

먼저 이미지를 설정하는 방법에 대한 몇 가지 코드를 표시합니다. –

+0

조금 더 설명해 주시겠습니까? – Sameer

답변

-1
public class IndexImageAdapter extends BaseAdapter { 

private Context context; 
private int[] panicBuyingImages = {R.drawable.q1 , R.drawable.q2 , R.drawable.q3 , R.drawable.q4}; 
public IndexImageAdapter(Context context){ 
    this.context = context; 
} 

public int getCount(){ 
    return Integer.MAX_VALUE; 
} 

public Object getItem(int arg0){ 
    return arg0; 
} 

public long getItemId(int position){ 
    return position; 
} 

public View getView(int position, View convertView, ViewGroup parent) { 
    ImageView i = new ImageView(this.context); 
    i.setImageResource(this.panicBuyingImages[position % panicBuyingImages.length]); 
    i.setScaleType(ImageView.ScaleType.FIT_XY); 
    i.setLayoutParams(new Gallery.LayoutParams(140, 140)); 
    return i; 
} 

}

관련 문제