0

I am using gridview for showing images as described here http://developer.android.com/guide/topics/ui/layout/gridview.html.

My adapter getView() method is:

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        Log.i("count",""+1);
        ImageView imageView;
        ViewHolder holder = null;
        if (convertView == null) {
            imageView = new ImageView(context);
            imageView.setLayoutParams(new GridView.LayoutParams(85, 95));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(3, 3, 3, 3);


        }
        else{
            imageView = (ImageView) convertView;

        }
        String bookTemp = books.get(position);
       imageView.setImageDrawable(context.getResources().getDrawable(R.drawable.book1));
        //imageView.setImageResource(R.drawable.book2);
        return imageView;
    }

But the images my device is showing is blurred.I have tried changing size also but the result comes out same every time.I am not getting what am I doing wrong here?I have also attached sample image below as well which I am using for testing.

enter image description here

Anshul
  • 7,914
  • 12
  • 42
  • 65

1 Answers1

0

sorry i had to make it an answer to reply your above question according to docs:
android will treat the images base on where they are putted on the below folders.

ldpi: Low-density screens; approximately 120dpi.
mdpi: Medium-density (on traditional HVGA) screens; approximately 160dpi.
hdpi: High-density screens; approximately 240dpi.
xhdpi: Extra high-density screens; approximately 320dpi. Added in API Level 8
nodpi: This can be used for bitmap resources that you do not want to be scaled to match the device density.
tvdpi: Screens somewhere between mdpi and hdpi; approximately 213dpi. This is not considered a "primary" density group. It is mostly intended for televisions and most apps shouldn't need it—providing mdpi and hdpi resources is sufficient for most apps and the system will scale them as appropriate. This qualifier was introduced with API level 13.

for more reading about these stuff click on this

Kosh
  • 6,140
  • 3
  • 36
  • 67